Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stored Procedure Problem

 
Nee Kat
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic