jill han wrote:
>Below is a piece of code to get records from a table and exception
>// startDate and endDate are Date object
>// aDate has Date data type in oracle db
>String sql = "Select * from aTable ";
>sql = sql + " Where aDate ";
>sql = sql + " Between '" + startDate + "' And '" + endDate + "' ";
>List sqlResult = aTablePeer.executeQuery(sql);
>
>org.apache.torque.TorqueException: ORA-01858: a non-numeric character
>was found where a numeric was expected
>
>
I'm assuming you're asking why this didn't work.
java.util.Date's toString returns something along the following lines:
Wed Nov 09 11:19:05 GMT-05:00 2005
which isn't what an SQL date looks like (although I don't deal with
Oracle much, so I could be completely wrong).
You'll want to convert it to a format that Oracle understands.
I thought the Criteria date stuff would do that work for you (I don't
know that either, though ) If that's true, is there a reason to avoid
Criteria for this usecase?
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
|