title: How to call Oracle stored procedure which accepts RefCursor as out parameter using Entity Framework
body: <p>I have an Oracle stored procedure which accepts multiple out parameters of type RefCursor (code below). </p>
  
  <pre><code>create or replace 
      PROCEDURE PROCEDURE1(
      lookupvalues out SYS_REFCURSOR,
      lookupvalues1 out SYS_REFCURSOR)
  AS 
  BEGIN
      open lookupvalues for
      select attribute3 from table1 where attribute3 is not null;
      open lookupvalues1 for 
      select attribute1 from table2 where attribute1 is not null;
  END PROCEDURE1;
  </code></pre>
  
  <p>I just need to get the result of those out parameter as data set using c# and Entity Framework.</p>
  
  <p>I am able to get the data but I don't think it's a decent approach.</p>
  
  <p>I want to use Entity Framework for retrieving the data (if possible).</p>
  
  <pre><code>using (APWCContext dbcontext = new APWCContext())
  {
      using (var cmd = dbcontext.Database.Connection.CreateCommand())
      {
          cmd.CommandType = CommandType.StoredProcedure;
          cmd.CommandText = "PROCEDURE1";
  
          var businessUnit = new OracleParameter("lookupvalues", OracleDbType.RefCursor, ParameterDirection.Output);
          var currency = new OracleParameter("lookupvalues1", OracleDbType.RefCursor, ParameterDirection.Output);
          cmd.Parameters.AddRange(new[] { businessUnit,currency});                              
          cmd.Connection.Open();                    
          var reader= cmd.ExecuteReader();
          DataTable budt = new DataTable();                   
          while (reader.Read())
          {
              budt.Load(reader);
          }                                        
          var data = businessUnit.Value;                                                     
          cmd.Connection.Close();
      }
      //var businessUnit = new OracleParameter("lookupvalues", OracleDbType.RefCursor, ParameterDirection.Output);
      var r = dbcontext.GOODWILL_HEADER_STG.FirstOrDefault();
  
      //var result = dbcontext.Database.ExecuteSqlCommand("BEGIN PROCEDURE1(:lookupvalues); END;", businessUnit);
  }
  </code></pre>