title: Execute a Stored Procedure that returns a custom Cursor?
body: <p>Given a custom cursor type:</p>
  
  <pre><code>create or replace 
  PACKAGE                               Types AS
    TYPE cursor_type IS REF CURSOR;
  END Types;
  </code></pre>
  
  <p>And a stored procedure that returns this type:</p>
  
  <pre><code>create or replace 
  procedure TheProcedure
  (RS OUT someSchema.TYPES.CURSOR_type, someCode number)
  is 
  begin
  open RS for 
      --A custom query
       select 
              someTable.field,
              anotherTable.field,
  
        from someTable,
             anotherTable,
         where 
             anotherTable.code = someTable.code
             AND someTable.someFK = someCode;
  end TheProcedure;
  </code></pre>
  
  <p>I need to retrieve all data using ODP.Net (Oracle.DataAccess.Client)</p>
  
  <pre><code>string connectionString = ConfigurationManager.ConnectionStrings["cnx"].ConnectionString;
  using (OracleConnection conn = new OracleConnection(connectionString))
  {
      conn.Open();
  
      OracleCommand cmd = new OracleCommand();
      cmd.Connection = conn;
  
      cmd.CommandText = "ASCHEMA.TheProcedure";
      cmd.CommandType = System.Data.CommandType.StoredProcedure;
  
      OracleParameter prmCursor = cmd.Parameters.Add("RS", OracleDbType.RefCursor);
      prmCursor.Direction = ParameterDirection.Output;
      cmd.Parameters.Add("someCode", OracleDbType.NVarchar2).Value = 19685;
      //the integrity of the sql query was verified
      cmd.ExecuteNonQuery();
      OracleDataReader anotherReader = ((OracleRefCursor)prmCursor.Value).GetDataReader();
  
      while (anotherReader.Read())
      {
          var some = !anotherReader.IsDBNull(0) ? anotherReader.GetValue(0) : 0;
      }
  }
  </code></pre>
  
  <p>But the reader <code>anotherReader</code> never returns data, I think that I need to do some special stuff for the User Defined Type <code>TYPE.cursor_type</code>, but how?</p>
  
  <p>Thanks in advance.</p>