WasNull() method to handle null database fields

Which of the following methods eliminates the need to call wasNull() method to handle null database fields?

a)getObject()
b)getInt()
c)getString()
d)getFloat()
e)getNull()

Questions by ravikumar3

Showing Answers 1 - 9 of 9 Answers

kittupeddi

  • Apr 10th, 2008
 

There are two ways you can do this:

1> wasNull() method, which indicates the last column read was null or not.
ex: if(rs.wasNull()) { ... }

2> Use the getObject(xx); and compare the values:
   Object o = rs.getObject("xxx");
   if(o == null) { ... }

  Was this answer useful?  Yes

kittupeddi

  • Apr 10th, 2008
 

Two Ways:

1> Use the wasNull() method on the ResultSet.

2> Use the getObject() method on the ResultSet and do the Comparision.

  Was this answer useful?  Yes

To my understanding, the question  isn't framed properly.

The answers given by two fellows above are ways to go around this situation but none eliminates the need to call wasNull().

Other views are appreciated !!!

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions