title: C# OraOLEDB Stored Procedure OUT Parameter
body: <p>I'm trying to call such a simple stored procedure by OraOLEDB provider in C#</p>
  
  <p>The procedure has only one OUT parameter. This doesn't work.</p>
  
  <p>DataTable <strong>dt is null</strong> after that part calling <code>reader.GetSchemaTable()</code>.</p>
  
  <p>The funny thing is that I can make it works if I put REF CURSOR TYPE as output parameter with other stored procedure. This procedure doesn't have a problem. It can be called in sqlplus. I've read that I don't need to (actually must not) bind <code>REF CURSOR TYPE</code> manually. </p>
  
  <p>The problem is how to call a stored procedure which has non-cursor type out parameter by OraOLEDB in C#.</p>
  
  <p>Please give me some advice.</p>
  
  <p>Oracle 11g, Windows 7 64bit
  <a href="http://docs.oracle.com/cd/E11882_01/win.112/e17726/using.htm#OLEDB164" rel="nofollow">Link1</a>
  <a href="http://www.bowmain.pwp.blueyonder.co.uk/Computing/Oracle/Oracle.html" rel="nofollow">Link2</a></p>
  
  <pre><code>              try
                {
                    string connStr = "Provider=OraOLEDB.Oracle.1;User ID=scott;Password=tiger;Data Source=//localhost:1521/orcl;OLEDB.NET=1;PLSQLRSet=1;";
                    conn = new OleDbConnection(connStr);
                    conn.Open();
  
                    OleDbCommand cmd = new OleDbCommand();
                    cmd.Connection = conn;
  
                    OleDbParameter param = cmd.CreateParameter();
                    param.ParameterName = "O_ENAME";
                    param.Direction = ParameterDirection.Output;
                    param.OleDbType = OleDbType.Char;
                    param.Size = 15;
  
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add(param);
  
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "{CALL SCOTT.EMPINFO(?)}";
  
                    OleDbDataReader reader = cmd.ExecuteReader();             
                    DataTable dt = reader.GetSchemaTable();   
                }
  </code></pre>
  
  <p>stored procedure <code>EMPINFO</code></p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE
  EMPINFO(O_ENAME OUT VARCHAR2)
  IS
  BEGIN
  SELECT ENAME
  INTO O_ENAME
  FROM EMP
  WHERE EMPNO=7369;
  END;
  /
  </code></pre>