문제

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 ?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top