Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to find if the Result Set is empty?

843859Aug 25 2008 — edited Aug 26 2008
Folks, I have a basic question in JDBC. Say, I call executeQuery() on a CallableStatement object like this:

ResultSet rs = callableStatement.executeQuery();

How to find out if the result set 'rs' has any data in it or not i.e. whether the query has returned any results? The API doc says that 'rs' is never null. So that cannot be used to check if its empty. Also, ResultSet API doesn't have any method to return the number of rows returned as a result of executing the query.
Also, how to find the number of rows in the result set?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2008
Added on Aug 25 2008
7 comments
4,717 views