aspose file tools*
The moose likes JDBC and the fly likes getInt() on a NULL value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getInt() on a NULL value" Watch "getInt() on a NULL value" New topic
Author

getInt() on a NULL value

Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
I am using this code;
int myInt = myResultSet.getInt("myValue")
The problem is that I need to know if myValue is NULL in the database or if it is actually 0.
How is this done please?
Many thanks...
Snigdha Solanki
Ranch Hand

Joined: Sep 07, 2000
Posts: 128
You can use wasNull() method to check if the last column read had a value of SQL NULL. Before that call getInt() to read the value.


Snigdha<br />Sun Certified Programmer for the Java™ 2 Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getInt() on a NULL value