A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Murach's Java Servlets and JSP
this week in the
how to handle when procedure returns more than one resultset
Joined: Feb 10, 2005
Dec 19, 2005 00:31:00
can we handle when a procedure returns more than one resultset.if so, please help me.
Joined: Dec 19, 2005
Dec 19, 2005 05:23:00
and what's a problem? just register more than one output parameters. And execute the procedure ...
Computers are like air conditioners - They stop working properly when you open Windows
Joined: Oct 23, 2005
Dec 19, 2005 08:02:00
I think your asking about multiple result sets, not multiple columns in a single result set.
In that case, you have to make sure the database/driver support this fluidly. If so, you can use getMoreResults() and getResultSet() to iterate through additional results sets.
I refer you to the following IBM article:
1. Invoke the Statement.execute method or PreparedStatement.execute method to call the stored procedure. Use PreparedStatement.execute if the stored procedure has input parameters. 2. Invoke the getResultSet method to obtain the first result set, which is in a ResultSet object. 3. In a loop, position the cursor using the next method, and retrieve data from each column of the current row of the ResultSet object using getXXX methods. 4. If there are n result sets, repeat the following steps n-1 times: 1. Invoke the getMoreResults method to close the current result set and point to the next result set. 2. Invoke the getResultSet method to obtain the next result set, which is in a ResultSet object. 3. In a loop, position the cursor using the next method, and retrieve data from each column of the current row of the ResultSet object using getXXX methods.
[ December 19, 2005: Message edited by: Scott Selikoff ]
Down Home Country Coding with Scott Selikoff
I agree. Here's the link:
subject: how to handle when procedure returns more than one resultset
calling SQL Server stored procedures
getting empty resultset
Executing procedure in Hibernet with more than one out parameters
Diff bet execute() and executeQuery()
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014