views:

443

answers:

1

Hello, I am using OLEDB driver to call a Stored Procedure in Oracle DB. The Stored Proc returns a cursor as the output. I am able to call this Stored Proc using Oracle Data Source (System.Data.Oracle.OracleCommand), However I do not know how to call this SP using the OLEDB data source. Any help on how to specify the SP is returning a cursor as the output using OLEDB would be greatly appreciated.


private static OracleCommand CreateOraStoredProcCmd()
                {
                        string storedProcName = "pkg_query.prc_get_my_trades";
                        OracleCommand cmd = new OracleCommand(storedProcName);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("book_list", "Jan, Feb");
                        cmd.Parameters.AddWithValue("maturity_date_start", DateTime.Now.ToString("dd-MMM-yyyy"));
                        cmd.Parameters.AddWithValue("maturity_date_end", DateTime.Now.ToString("dd-MMM-yyyy"));
                        cmd.Parameters.AddWithValue("ccy_list", "GBP,USD");
                        cmd.Parameters.Add("trades", OracleType.Cursor).Direction = ParameterDirection.Output;
                        return cmd;
                }

I do not know how to specify the parameter "trades" is an output cursor on the OledbCommand object.

Thanks in advance!

+1  A: 

The Oracle Provider for OLE DB converts any parameters that reference cursors into an ADO Recordset, but only if PLSQLRSet=1 is added to your connection string.

Mitch Wheat