• Post Reply Bookmark Topic Watch Topic
  • New Topic

timestamp null  RSS feed

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get all entries from a table in db2 where a certain timestamp is not set. If I use a query "select something, myTimestamp from myTable", and I print myResultSet.getTimeStamp("myTimestamp"), the answer is null;

However, if I try to select all the empty timestamps with a preparedStatement:
preparedStatement = "select something from myTable where myTimestamp=?";
preparedStatement.setTimeStamp(1, null);
I do not get any results!
Does anybody know how can I find the empty timestamps?
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to use IS NULL instead of = .
where timeStamp IS NULL
[ October 13, 2004: Message edited by: David Ulicny ]
 
Author and ninkuma
Marshal
Posts: 66352
155
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although I've never tried it, you might want to try out the setNull() method of the PreparedStatement to see if that suits your needs.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think both the above mentioned option would work for you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!