How to find if the Result Set is empty?
843859Aug 25 2008 — edited Aug 26 2008Folks, 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.