Page 1 of 1

About Question enthuware.ocpjp.v11.2.3644 :

Posted: Wed Jun 05, 2024 10:06 pm
by gadsgadsx
The point 4 of explanation states:

Code: Select all

boolean hasResults = stmt.execute();
//check if the stored proc has returned one or more ResultSets 
while (hasResults) {    
  ResultSet rs = stmt.getResultSet();    
  // process result set    
  hasResults = stmt.getMoreResults(); 
}
The method stmt.getMoreResults() moves the pointer to the next result set? If the procedure returns more than 1 result set, how to iterate between the result sets?

Re: About Question enthuware.ocpjp.v11.2.3644 :

Posted: Wed Jun 05, 2024 10:33 pm
by admin
gadsgadsx wrote:
Wed Jun 05, 2024 10:06 pm
The method stmt.getMoreResults() moves the pointer to the next result set?
Yes. See this https://docs.oracle.com/en/java/javase/ ... oreResults()
If the procedure returns more than 1 result set, how to iterate between the result sets?
The code that you have quoted above shows exactly what you have asked.