How to handle more than one ResultSet in Java?

From: Martin Benda (Martin.Benda_at_utanet.at)
Date: 10/07/03


Date: 7 Oct 2003 03:33:14 -0700

Hello!

How to process multiple ResultSets?
I have a stored procedure which returns two select queries.
The fist Query is a Result of a Select Statement
the second one is a self build costruct which shows the state of
the execution, e.g.

<!-- stored procedure starts here -->
/* do some update, insert stuff .. */

/* do a select */
SELECT * FROM Price

/* when all gone ok - IF @@ERROR = 0 ... */
SELECT 1 AS Success

/* when not */
SELECT 0 AS Success

<!-- end of stored procedure -->

In my java code i call

rs = stmt.executeQuery(...)

and i get always the first resultset (SELECT * FROM Price)
How do i retrieve the second one (SELECT X As Success)
In VB.Net this can be done thru the method
[DataReader].NextResult()

Is there a method similar in Java?