dcsimg
What is the most efficient way to detect records with NULL values returned in a ResultSet?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   David_Smith
Posted On:   Wednesday, March 21, 2001 07:45 AM

Using ResultSet.getString( int ) returns the string "null" if the record's value is null . This is not the record's true value. Does one really have to call ResultSet.wasNull() for every record returned in every ResultSet ? Is there a more efficient way?

Re: What is the most efficient way to detect records with NULL values returned in a ResultSet?

Posted By:   PRAVEEN_MOTURU  
Posted On:   Wednesday, December 12, 2001 11:20 PM

Please use the getObject() method. If a column record is null, getObject() always retuns null.


Sample:


Object obj = rs.getObject(1);

if (obj != null)

out.append(obj.toString());
About | Sitemap | Contact