aspose file tools*
The moose likes JDBC and the fly likes what is the equivalent data type for Oracle Cursor. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "what is the equivalent data type for Oracle Cursor." Watch "what is the equivalent data type for Oracle Cursor." New topic
Author

what is the equivalent data type for Oracle Cursor.

Prasad Desai
Greenhorn

Joined: Apr 30, 2001
Posts: 10
Hi,
I am using Oracle 8i as my BackEnd. I am using a Stored Procedure present in Oracle, which takes two IN parameter and one OUT parameter. Say the proc. will look something like this.
" testProc(intVar1 IN Integer,
strVar2 IN varchar,
cusrRec OUT curdsor_reference) "
Now how can I pass my OUT variable as a CURSOR to my Procedure when I call it in Javacode. What is the equivalent DataType for SQL Cursor in Java? How can i handle SQL Cursor in my Java Code?
Expecting for an immediate Reply.
Thanks in Advance.
Sridhar.


Roland TEST
Greenhorn

Joined: Mar 05, 2003
Posts: 1
I have the same problem !! Have you figured it out ?
Vijay S. Rathore
Ranch Hand

Joined: Oct 29, 2001
Posts: 449
Hi,
try this
testProc(intVar1 IN Integer,
strVar2 IN varchar,
cusrRec IN OUT curdsor_reference)

Make the curdsor_reference as IN and OUT parameter both.
And in Java use this code.
CallableStatement cstmt = con.prepareCall("{call testProc(?,?,?)}");
cstmt.setInt(1);
cstmt.setString(2);
cstmt.registerOutParameter(3, oracle.jdbc.OracleTypes.CURSOR);
cstmt.execute();
ResultSet result = (ResultSet) cstmt.getObject(3);

Vijay


SCJP, SCJD, SCWCD1.4, IBM486, IBM484, IBM 483, IBM 287, IBM141, IBM Certified Enterprise Developer - WebSphere Studio, V5.0
Author of IBM 287 Simulator Exam
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: what is the equivalent data type for Oracle Cursor.
 
Similar Threads
getting error for fetching result from oarcle with outparameter
Execution of stored procedure using for loop
pass a cursor between databases
How to pass a ROWTYPE parameter to an Oracle Stored Procedure?
cursor?