*
The moose likes JDBC and the fly likes Invoking a Oracle Stored Proc which takes a REF CURSOR as a IN parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invoking a Oracle Stored Proc which takes a REF CURSOR as a IN parameter" Watch "Invoking a Oracle Stored Proc which takes a REF CURSOR as a IN parameter" New topic
Author

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

Akshay Sharma
Ranch Hand

Joined: Mar 27, 2003
Posts: 42
Is it possible to invoke a SP using JDBC where in one of the IN parameters to the SP is a REF CURSOR.


Akshay Kumar Sharma<br />**********************<br />Good Better Best <br />Never Let it rest<br />For your good is better<br />and the better is the best
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

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 ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Akshay Sharma
Ranch Hand

Joined: Mar 27, 2003
Posts: 42
Its a IN parameter my dear.
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Just edited my last post kindly refer again
Akshay Sharma
Ranch Hand

Joined: Mar 27, 2003
Posts: 42
No I am wondering if this is possible
I dont have any such condition as mentioned in your edited note
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

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

Joined: Jun 27, 2009
Posts: 1
Is it possible to invoke a Oracle Stored Proc which takes a REF CURSOR as a IN parameter. If yes. how?
 
jQuery in Action, 2nd edition
 
subject: Invoking a Oracle Stored Proc which takes a REF CURSOR as a IN parameter