Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invoking a Oracle Stored Proc which takes a REF CURSOR as a IN parameter

 
Akshay Sharma
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to invoke a SP using JDBC where in one of the IN parameters to the SP is a REF CURSOR.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you sure In parameter is REF CURSOR.... ???

I think it would be out parameter


For out parameter

registerOutParameter as oracle.jdbc.driver.OracleTypes.CURSOR

then get the output of CallableStatement as Object

eg:

let you have sp_abcd ( input_variable ,out_cursor) a stored procedure

CallableStatement cs = conn.prepareCall("execute sp_abcd(?,?)")

cs.setString(1,String_variable);
cs.registerOutParameter(2,oracle.jdbc.driver.OracleTypes.CURSOR)

ResultSet rs = (ResultSet) cs.getObject(2);

then you can process your REF CURSOR as resultset


For In parameter

If You have a In paramter as REF CURSOUR then how you are planning to pass your REF CURSOR

if you input ref cursor is output of another strored procedure

then you can do same in either way

one > Call you sp haveing parameter from previous one SP

two > If you are getting you ref cursor after executing a SP from Java then
you can set it as
cs.setObject(2, (Object) your ref cursor, Oracle.jdbc.driver.OracleTypes.CURSOR)




hope this work for you
[ November 03, 2004: Message edited by: Shailesh Chandra ]
 
Akshay Sharma
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a IN parameter my dear.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just edited my last post kindly refer again
 
Akshay Sharma
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I am wondering if this is possible
I dont have any such condition as mentioned in your edited note
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Akshay Sharma:


I dont have any such condition as mentioned in your edited note


So what is your condtion

Or it was just a thought, if we can do it or not ....???
 
catch me
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to invoke a Oracle Stored Proc which takes a REF CURSOR as a IN parameter. If yes. how?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic