/ Published in: C#
Very important to set the RefCursor Type. Otherwise you get the PLS-00306 Error 'Wrong Number or types of arguments'
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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()); }