Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using SYSDATE in a PreparedStatement

74450Dec 3 2002
I feel sure this must have done already, but ....

I need to use a PreparedStatement to insert rows. The table has a DATE column and I want to use the SYSDATE value.
I've tried using setString("SYSDATE") and setObject("SYSDATE") but I'm getting ORA-01585 errors each time.

What's the "official" mechanism for doing this?

I can't use a Date object from the client because I can't be sure the clent and server clocks will be in sync.

I also can't do SELECT SYSDATE FROM DUAL because the PreparedStatement is batched and I want the timestamp from
when the row actually hits the DB.

Any suggestions welcome.

Thanks in advance.
Andy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2003
Added on Dec 3 2002
11 comments
4,839 views