Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the equivalent data type for Oracle Cursor.

 
Prasad Desai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the same problem !! Have you figured it out ?
 
Vijay S. Rathore
Ranch Hand
Posts: 449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic