Problem: I got a field which is a BIGINT in the database (DB2), which is nullable and defaults to NULL,
when I get the resultset in my code how do I check for a null in the code. I am mapping the field to a long variable
i.e - when I do a rs.getLong how do I check for null before setting the value into some variable.
Thanks in advance.
Time is what we want the most, but what we use the worst. -- William Penn
posted 7 years ago
I see two ways to solve that.
First is to call rs.getObject, this should return null value in case of sql null.
Second and better solution is calling rs.wasNull immediately after rs.getLong. You find about null value after, not before, but is a better solution.