wood burning stoves 2.0*
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
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
 
Similar Threads
How to pass a javascript variable on a jsp to a servlet
Reading from XML file
fgets and fscanf
Arrays
Define constants !