• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stored Procedure Problem

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic