login button

How to use Oracle Ref Cursor variables in Data service

Forums :

Hi,

 

I would like to know how to invoke an oracle procedures or functions with REF CURSOR as the OUT parameter from Data service?

I'm aware of the other thread which depicts how to invoke procedures with INOUT varialbes but i'm looking for an example with REF CURSOR.

 

Thanks in advance,

-Pankaj

 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi Pankaj.Currently this is

Hi Pankaj.

Currently this is a limitation we have. When it comes to dealing with Oracle stored procedures returning cursors, a different approach has to be taken when registering out parameters. (Please see the highlighted section in bellow code snippet).

i.e cstmt.registerOutParameter(1,OracleTypes.CURSOR);

Due to this reason we have to take an alternative approach when processing Oralce stored procedures returning cursors. We have planned for this, but have not implemented.

Is this an urgent requirement from your side? If so, please let us know. We might be able to pull this task to a top level priority.

Thanks,

/sumedha

 

(Extracted from http://asktom.oracle.com/tkyte/ResultSets/)
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
 

class curvar
{
  public static void main (String args [])
                     throws SQLException, ClassNotFoundException
  {
      String driver_class = "oracle.jdbc.driver.OracleDriver";
      String connect_string = "jdbc:oracle:thin:@slackdog:1521:oracle8";

      String query = "begin :1 := sp_listEmp; end;";
      Connection conn;

      Class.forName(driver_class);
      conn = DriverManager.getConnection(connect_string, "scott", "tiger");

      CallableStatement cstmt = conn.prepareCall(query);
      cstmt.registerOutParameter(1,OracleTypes.CURSOR);
      cstmt.execute();
      ResultSet rset = (ResultSet)cstmt.getObject(1);

      while (rset.next ())
        System.out.println( rset.getString (1) );
      cstmt.close();
  }
} 

 

Hi Sumedha,   Thanks for

Hi Sumedha,

 

Thanks for looking into this. But yes, this is very important functionality that we would like to have. Just beacause of this limitation, we are not able to use Data Service from WSO2.

I would be glad if you could expedite the developement of this feature.

 

thanks,

-Pankaj

Hi Pankaj, We have planned

Hi Pankaj,

We have planned to start work on this by beginning of next week. Hopefully you will hear from us by end of week.

Thanks

/sumedha

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.