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

written by objects \\ tags: , ,

Array ( ) One Response to “How to check if database column contains NULL?”

  1. Panama Promociones Says:

    Me English no better, but had to say me like what you say. Thank you from Panama.

Leave a Reply

You must be logged in to post a comment.