passing a cursor to a stored procedure from Java 
Author Message
 passing a cursor to a stored procedure from Java
Hello all,
how can I pass a cursor as an in/out-parameter to a procedure from Java?
I tried the following but it didn't work.
When I call the procedure from commandline it works fine.

...
ResultSet refcur = null;
CallableStatement statement = conn.prepareCall("{ ? = call sp_CustomerVerify
(?,?)}");
statement.registerOutParameter(1, OracleTypes.CURSOR);
statement.setObject(2, refcur);
statement.setString(3, custno);
statement.execute();
...

Michael



Mon, 07 Jan 2002 03:00:00 GMT
 passing a cursor to a stored procedure from Java

Did you try something like this? BTW, don't forget to post the error
messages that you get the next time.

Filip

CallableStatement cstmt;
  ResultSet cursor;

  // Use a PL/SQL block to open the cursor
  cstmt = conn.prepareCall
             ("begin open ? for select ename from emp; end;");

  cstmt.registerOutParameter (1, OracleTypes.CURSOR);
  cstmt.execute ();
  cursor = ((OracleCallableStatement)cstmt).getCursor (1);

  // Use the cursor like a normal ResultSet
  while (cursor.next ())
    {System.out.println (cursor.getString (1));}


Quote:
> Hello all,
> how can I pass a cursor as an in/out-parameter to a procedure from Java?
> I tried the following but it didn't work.
> When I call the procedure from commandline it works fine.

> ...
> ResultSet refcur = null;
> CallableStatement statement = conn.prepareCall("{ ? = call
sp_CustomerVerify
> (?,?)}");
> statement.registerOutParameter(1, OracleTypes.CURSOR);
> statement.setObject(2, refcur);
> statement.setString(3, custno);
> statement.execute();
> ...

> Michael



Mon, 07 Jan 2002 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. passing a cursor to a stored procedure from Java

2. passing a cursor to a stored procedure from Java

3. Calling a Java Stored Procedure from another Java Stored Stored Procedure

4. Gettting SQL0751N trying to call java stored procedure from a java stored procedure

5. Passing a cursor from Java to an Oracle stored proc

6. Passing a cursor from Java to an Oracle stored proc

7. Passing cursors to/from stored procedures via ADO

8. How to pass a REF CURSOR to a stored procedure

9. Oracle stored procedure Cursor parameter passing?

10. easy question: pass table/rowset/cursor to a stored procedure

11. Passing cursor/result set to extended stored procedure

12. Passing Java Array To Stored Procedure


 
Powered by phpBB® Forum Software