title: Issue using Dapper with C# to call an Oracle stored proc with refcursor as out parameter, however refcursor as return value works
body: <p>Given this oracle stored proc package:</p>
  
  <pre><code>CREATE OR REPLACE 
  PACKAGE TESTPKG AS 
    FUNCTION TestReturnRefCursor RETURN SYS_REFCURSOR;
    PROCEDURE TestingRefCursorsAsOutParam (outp OUT SYS_REFCURSOR);
  END TESTPKG
  </code></pre>
  
  <p>And this package body:</p>
  
  <pre><code>CREATE OR REPLACE
  PACKAGE BODY TESTPKG AS
  
    FUNCTION TestReturnRefCursor RETURN SYS_REFCURSOR AS
      outp SYS_REFCURSOR;
    BEGIN
      OPEN outp FOR SELECT * FROM TABLENAME;
      RETURN outp; 
    END TestReturnRefCursor;
  
    PROCEDURE TestingRefCursorsAsOutParam (outp OUT SYS_REFCURSOR) AS 
    BEGIN
      OPEN outp FOR SELECT * FROM TABLENAME;
    END TestingRefCursorsAsOutParam;
  
  END TESTPKG;
  </code></pre>
  
  <p>I am trying to use Dapper to call either function. I have created the OracleDynamicParameters class that implements Dapper.SqlMapper.IDynamicParameters that I found at this post after searching StackOverflow: <a href="https://gist.github.com/vijaysg/3096151" rel="nofollow">https://gist.github.com/vijaysg/3096151</a></p>
  
  <p>Calling the TestReturnRefCursor stored function works fine with this code:</p>
  
  <pre><code>        var conn = new OracleConnection(ConfigurationManager.ConnectionStrings["DataConnection"].ConnectionString);
          conn.Open();
          var p = new OracleDynamicParameters();
          p.Add("retSet", dbType: OracleDbType.RefCursor, direction: ParameterDirection.ReturnValue);
          conn.Execute("TESTPKG.TestReturnRefCursor ", param: p, commandType: CommandType.StoredProcedure);
          var refcur = p.Get&lt;OracleRefCursor&gt;("retSet");
          // do something with refcur
          conn.Close();
  </code></pre>
  
  <p>However, when I try to call the TestingRefCursorsAsOutParam stored procedure with this code:</p>
  
  <pre><code>var conn = new OracleConnection(ConfigurationManager.ConnectionStrings["DataConnection"].ConnectionString);
  conn.Open();
  var p = new OracleDynamicParameters();
  p.Add("retSet", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);
  conn.Execute("TESTPKG.TestingRefCursorsAsOutParam ", param: p, commandType: CommandType.StoredProcedure);
  var refcur = p.Get&lt;OracleRefCursor&gt;("retSet");
  // do something with refcur
  conn.Close();
  </code></pre>
  
  <p>I get an OracleException from the Oracle.ManagedDataAccess.dll with the detail:</p>
  
  <pre><code>"ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of arguments in call to 'TESTINGREFCURSORSASOUTPARAM'\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored"
  </code></pre>
  
  <p>I found after searching another stackoverflow post where sometimes parameters aren't bound if they are null unless you specifically set their value to be DBNull.Value, so I tried changing the add parameter line to be:</p>
  
  <pre><code>p.Add("retSet", value: DBNull.Value, dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);
  </code></pre>
  
  <p>but this did not help.</p>
  
  <p>I can call this stored procedure just fine using regular c# oracle code:</p>
  
  <pre><code>var cmd = conn.CreateCommand();
  cmd.CommandText = "TESTPKG.TestingRefCursorsAsOutParam";
  cmd.CommandType = CommandType.StoredProcedure;
  
  var outparam = new OracleParameter();
  outparam.ParameterName = "retSet";
  outparam.Direction = ParameterDirection.Output;
  outparam.OracleDbType = OracleDbType.RefCursor;
  
  cmd.Parameters.Add(outparam);
  
  OracleDataAdapter da = new OracleDataAdapter(cmd);
  cmd.ExecuteNonQuery();
  
  var refcur = (OracleRefCursor)cmd.Parameters[0].Value;
  </code></pre>
  
  <p>Is there something I am missing here, or is Dapper not functioning correctly?</p>