Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I get data from multiple ResultSets?

Data resultsets
0
Posted

How can I get data from multiple ResultSets?

0

With certain database systems, a stored procedure can return multiple result sets, multiple update counts, or some combination of both. Also, if you are providing a user with the ability to enter any SQL statement, you don’t know if you are going to get a ResultSet or an update count back from each statement, without analyzing the contents. The Statement.execute() method helps in these cases.Method Statement.execute() returns a boolean to tell you the type of response: true indicates next result is a ResultSet,Use Statement.getResultSet() to get the ResultSet false indicates next result is an update count Use Statement.getUpdateCount() to get the update count false also indicates no more results Update count is -1 when no more results (usually 0 or positive). After processing each response, you use Statement.getMoreResults() to check for more results, again returning a boolean.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123