Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    14

    Question Unanswered: Getting Recordsets from Stored Procedure

    Hi Folks,

    How do I access Recordsets in Java from an Oracle STored Procedure.

    I know that I can return a recordset from a stored procedure in oracle through an output parameter, that contains a cursor. But how can I access that cursor in Java?

  2. #2
    Join Date
    Feb 2003
    Location
    VA , USA
    Posts
    3

    Unhappy Re: Getting Recordsets from Stored Procedure

    Here are the logical / code steps.

    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    .....

    cstmt = conn.prepareCall("procedureName");
    //Assumiing Dates 2 parameters,
    cstmt.setDate(1, p1Date);
    cstmt.setDate(2, p2Date);
    // Third Parameter is Cursor
    cstmt.registerOutParameter(3, OracleTypes.CURSOR);
    cstmt.execute();

    rs = (ResultSet) ((OracleCallableStatement)cstmt).getObject(3);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •