wood burning stoves 2.0*
The moose likes JDBC and the fly likes How resultset is returned by stored procedure? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How resultset is returned by stored procedure?" Watch "How resultset is returned by stored procedure?" New topic
Author

How resultset is returned by stored procedure?

Hemant Agarwal
Ranch Hand

Joined: Nov 21, 2005
Posts: 138
How resultset is returned by stored procedure?
I know that by using Callable Statement we can call stored procedures. But if that stored procedure is returning a resultSet, then how will you handle that resultset?
Harshil Mehta
Ranch Hand

Joined: Mar 17, 2005
Posts: 64
Hi Hemant,

Say you stored procedure is sp_emp for famous Oracle emp table:




Now when you run the procedure from SQL prompt, it will return records for all the employees which is essentially a resultset. That's how the stored procedure can return resultset.

Now in yor java code:


The above code will give you all the employee records in resultset rst. So you can not use the resultset same way as you use for adhoc queries.

hth,
Harshil
Hemant Agarwal
Ranch Hand

Joined: Nov 21, 2005
Posts: 138
So you can not use the resultset same way as you use for adhoc queries.

What do you mean by that?
Harshil Mehta
Ranch Hand

Joined: Mar 17, 2005
Posts: 64
Sorry Hemant,

It was a typo , i meant to say "Now you can use". not "Now you can not use".

--Harshil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How resultset is returned by stored procedure?
 
Similar Threads
CallableStatement ResultSet
Resultset returned by stored proc not forward only
cs.executeQuery() throws "Query returned no data" error
calling a stored procedure
How to create Multiple Resultset in oracle