File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes about Null in ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "about Null in ResultSet" Watch "about Null in ResultSet" New topic

about Null in ResultSet

saravana kumar
Ranch Hand

Joined: Jun 25, 2002
Posts: 72
hi friends,
i needs ur help. how to check wheather Result is null or Not.i have written a query which is selecting data from table with one condition. if there is none of a record satisfied the condition it should be returned null. how to check that one? any one knows please let me know with example.

thanks a lot friends...
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
do this
do that


Want to do something great will do one day
Nandkishore Dhilde

Joined: May 09, 2002
Posts: 20
or you can do after firing query
int rowcount = rs.getRow(); //rs is ResultSet object
if(rowcount ==0) // then ur query returns null result and if more than 0 then go for

SCJP1.4 certified, IBM SOA Solution Designer[2007]
It is sorta covered in the JavaRanch Style Guide.
subject: about Null in ResultSet
Similar Threads
null value
Vector question?
null pointer exception
Question re: nested IF statements