Try using a date object in the where clause

  public static Date getCurrentDateTimeOffset(long seconds) throws
Exception {
        long now = System.currentTimeMillis();
        return new Date(now - seconds * 1000);
    }

            Date dischargedAfter =
TimeCalculator.getCurrentDateTimeOffset(14400L);

            OQLQuery oql = _db.getOQLQuery("SELECT p FROM
vanderbilt.ed.encounters.EDEncounterRec p where   p.dateDischarged  > $2
order by            p.dateAdmitted");
               oql.bind(dischargedAfter);



                                                                                       
                            
                    Sean Rohead                                                        
                            
                    <SRohead@webm        To:     [EMAIL PROTECTED]                 
                            
                    iles.com>            cc:                                           
                            
                                         Subject:     [castor-dev] bug handling OQL 
date literals                  
                    01/28/2002                                                         
                            
                    01:59 PM                                                           
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    castor-dev                                                         
                            
                                                                                       
                            
                                                                                       
                            



I am trying to use a date literal in an OQL statement and it chokes on
oracle.

The where clause looks like this:

where expireDate > Date'1-28-2002'

I get an error from the oracle driver when I try to execute this because
the
where clause of the query looks like:

WHERE ("BLAH"."EXPIRE_DATE" > '1-28-2002')

when for oracle it SHOULD BE > '28-Jan-2002' or the more portable JDBC
escape {d '2002-01-28'}

Thanks,

Sean Rohead

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
           unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to