Just want to add that if you really are interested in getting a null through the java interface, you must use the wasNull method.
So, this:
int ret_id;
if (rs.next()) { ... this is always true
ret_id = rs.getInt("ret_id"); <---
}
is wrong, but this:
int ret_id
if (rs.next()) { ... this is always true
ret_id = rs.getInt("ret_id");
if (rs.wasNull()){
//cant use the ret_id value, it is actually null!
} else {
//safely use the ret_id value
}
}
should work.
Note that you have to "get" the value first - always. Then you should check if it actually was NULL
check it out:
http://java.sun.com/j2se/1.4/docs/api/java/sql/ResultSet.html#wasNull()
Edited 1 time(s). Last edit at 12/13/2005 07:55PM by Roland Bouman.