aspose file tools*
The moose likes Java in General and the fly likes Stored Procedure Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Stored Procedure Problem" Watch "Stored Procedure Problem" New topic
Author

Stored Procedure Problem

Nee Kat
Ranch Hand

Joined: Jan 27, 2004
Posts: 37
I am calling a stored procedure in an oracle database.
It is executing properly but I am getting a problem in getting back the data.

Here is what I have:

CallableStatement cstmt = conn.prepareCall("{? = call device_search.qipep(?)}");
cstmt.registerOutParameter(1,OracleTypes.CURSOR);
cstmt.setString(2,ip_address);
cstmt.execute();

//When it reaches here an ORA-00900: invalid SQL statement is thrown.

ResultSet rs = (ResultSet)cstmt.getObject(1);

I think this problem could because of datatype mismatch.
Is there any other way of retrieving data from stored procedure.

Please help
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
You need to use other getObject(String parameterName, Map map) , providing map value to map from sql type Cursor to java type ResultSet.

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/CallableStatement.html
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Nee,

What is signature of your stored procedure, As I remember for calling Stored Procdure I used to crate CallableStatement like this

CallableStatement cstmt = conn.prepareCall("call device_search.qipep(?,?)");

thanks


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stored Procedure Problem
 
Similar Threads
Is it possible to execute stored procedure in hibernate.
Getting empty resultset for stored procedure having two returns
Oracle stored procedure result set ref problem
Error executing sql statement
getting the resultset of a stored procedure?