to_char in a where clause [message #1644] |
Fri, 17 May 2002 07:02 |
David
Messages: 110 Registered: November 1998
|
Senior Member |
|
|
Hello, i am trying to select data from a table which has a row called quotedate. this is a date datatype with values such as 01-may-02 (dd-mon-yy). Since I am working in java, and my date format is 01-05-02 (dd-mm-yy), i am trying to do
SELECT bytes FROM iq3_bkend_log WHERE userid=98 AND to_char(quotedate,'DD-MM-YYYY')='17-4-2002'
unfortunately i am not getting any rows at all- how can i do this?
|
|
|
|
Re: to_char in a where clause [message #1647 is a reply to message #1644] |
Fri, 17 May 2002 07:33 |
Dave
Messages: 92 Registered: August 1999
|
Member |
|
|
well heres my code
st1 = con.createStatement();
sSQL=" SELECT bytes ";
sSQL+=" FROM iq3_bkend_log ";
sSQL+= " WHERE userid="+uid;
sSQL+=" AND to_char(quotedate,'DD-MM-YYYY')='"+today+"'";out.println(sSQL);
rs=st.executeQuery(sSQL);
the variable today is a String which is in the format dd-mm-yyyy but the date in the database in in format dd-mon-yy. i cannot do TO_DATE('17-DEC-80','DD-MM-YYYY') because instead of DEC it would be 12
|
|
|