Reputation: 7133
I am doing this:
Select count(*) from table1 t where start_datetime = datetime(?);
Setting datetime using:
ps.setString("01-01-2010 12:12:00.123")
It is giving error as : Non numeric character in datetime or interval.
But if I run this as SQL in SQL Editor it works all fine.
Any clues how to correct this ?
Upvotes: 2
Views: 3778
Reputation: 8423
Change around the string to conform to the default datetime
date pattern
ps.setString("2010-01-01 12:12:00.1230")
I think something like this should also work
select count(*) from table1 t
where start_datetime = TO_DATE(?,"%Y-%m-%d %H:%M:%S %F3")
Let me know
Upvotes: 3