Return to Snippet

Revision: 653
at July 25, 2006 18:47 by rengber


Initial Code
Oracle.DataAccess.Client.OracleConnection OraConn = new Oracle.DataAccess.Client.OracleConnection();
            OraConn.ConnectionString = "Data Source=DBName;User Id=MyUser;Password=MyPW;";
            OraConn.Open(); 
            Oracle.DataAccess.Client.OracleCommand OraComm = new Oracle.DataAccess.Client.OracleCommand("RobCursorTestProc", OraConn);
            OraComm.CommandType = CommandType.StoredProcedure;
            OraComm.Parameters.Add("Cursor", Oracle.DataAccess.Client.OracleDbType.RefCursor, ParameterDirection.Output); 
            Oracle.DataAccess.Client.OracleDataReader OraDR = OraComm.ExecuteReader();
            if (OraDR.Read())
            {
                MessageBox.Show(OraDR.GetName(0));
                MessageBox.Show(OraDR.GetValue(0).ToString()); 
            }

Initial URL

                                

Initial Description
Very important to set the RefCursor Type.   Otherwise you get the PLS-00306 Error 'Wrong Number or types of arguments'

Initial Title
Oracle Stored Proc to Return a Recordset (.Net Side)

Initial Tags
Net, Oracle

Initial Language
C#