All pastes #261254 Raw Edit

Miscellany

public text v1 · immutable
#261254 ·published 2006-11-29 01:44 UTC
rendered paste body

hi
 
i have problem to use a date in a query
 
code:

Date datePublication;
cal.add(Calendar.MONTH,-12);
datePublication = genererDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
 
public Date genererDate(int pYear, int pMonth, int pDay){
  String strDate = Integer.toString(pYear) + "-" +  Integer.toString(pMonth) + "-" + Integer.toString(pDay);
  java.util.Date parsedDate = new java.util.Date();
                
  try {
        parsedDate = new SimpleDateFormat("yyyy-MM-dd").parse(strDate);
  } catch (ParseException e) {
        e.printStackTrace();
  }     
  return new java.sql.Date( parsedDate.getTime() );
}
 
datePublication show me
2005-10-01
 
i use directely in a query datePublication...
 
i displayed the query
[code]
select * from test where datePub >= 2005-10-01 

 
i get the error:
code:

java.sql.SQLException: ORA-00932: inconsistent datatypes: expected DATE got NUMBER

 

any idea?