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: , ,