Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to insert a null into a timezone column  RSS feed

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a SQL statement written in Java. I don't have access to modify the statement, only to populate the values that it needs. If I don;t have a timestamp value to add, what can I set as a default so that I won't keep getting this error:

ORA-01841: (full) year must be between -4713 and +9999, and not be 0

I tried stuff like '' and "". no Luck
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PreparedStatement + setTimestamp(null)
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anthony,
If you are using a "PreparedStatement" (as Paul suggests), then I believe you need its "setNull()" method, for example:

Good Luck,
Avi.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!