File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes How to Execute Stored Procedure? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to Execute Stored Procedure?" Watch "How to Execute Stored Procedure?" New topic

How to Execute Stored Procedure?

Sanjay Deshpande
Ranch Hand

Joined: May 22, 2001
Posts: 111
I have following SP
Create Procedure SP_Get_Status
@Status varchar(40) OUTPUT
Select @Status=Status from Status
My Java Code is like THis
CallableStatement cs=con.prepareCall("{call SP_Get_Status(?)}");
cs.registerOutParameter(1, java.sql.Types.VARCHAR);
Question 1.I get exception:
No ResultSet was produced
Where as this runs fine
Question 2:How to get a reslutset OBject out of this?
A Sundaram

Joined: Jan 08, 2003
Posts: 7
ResultSet rs;
rs = cs.getResultSet();
//do whatever you want to on the result set
Consider Paul's rocket mass heater.
subject: How to Execute Stored Procedure?
Similar Threads
Show total of each column
Regarding reultset in stored procedures
Stored Procedure question
Hibernate enum question
How to get a return value from the stored procedure using callable statement