Jun
04
|
If you are pulling a value from a database ResultSet it is somethimes not possible to check the value returned to determine if the value in the database was null. In these cases you can use the wasNull() method to check.
The wasNull() method will return true if the value in the database was NULL for the last value retrieved from ResultSet.
Here is an example of its usage.
ResultSet rs = statement.executeQuery(); int value = rs.getInt(1); if (rs.wasNull(1)) { // Database contains NULL }
Array ( ) One Response to “How to check if database column contains NULL?”
Leave a Reply
You must be logged in to post a comment.
September 23rd, 2010 at 3:53 am
Me English no better, but had to say me like what you say. Thank you from Panama.