title: From Stored Procedure, return OUT parameter & OUT cursor & parse result (Oracle)
body: <h1>Question : Is it possible to return using OUT :</h1>
  <h1>Both : A variable &amp; A cursor, from my code below ??</h1>
  <hr />
  <p>I saw a similar question for SqlDB but after a really long search found no solution for OracleDB.</p>
  <h2>In PLSQL :</h2>
  <pre><code>CREATE OR REPLACE
  PROCEDURE SPGETRESULTANDSETFLAG
  (
   pFilter VARCHAR2,
   pMaxRowCount VARCHAR2,
   pTableID RAW,
   myFlag OUT NUMBER,
   myCursor OUT types.cursorType
  )
  AS
  BEGIN
   Declare
    CountQuery VARCHAR(20000) := '';
    DataQuery VARCHAR(20000) := '';
    ResultingRows NUMBER := -1;
   Begin
    myFlag := -1;
  
    CountQuery := 'SELECT COUNT(*) FROM ' 
                  || F_GET_TABLENAME_FROM_ID(PTABLEID =&gt; pTableID)
                  || ' WHERE ' || pFilter;
    EXECUTE IMMEDIATE CountQuery INTO ResultingRows;
  
  
    --Get the Return Value
    if( pMaxRowCount &gt; ResultingRows ) then myFlag := 1; end if;
  
  
    DataQuery := 'SELECT * FROM '
                  || F_GET_TABLENAME_FROM_ID(PTABLEID =&gt; pTableID) 
                  || ' WHERE ' || pFilter; 
    --Get the Return Cursor
    Open myCursor for DataQuery;
  
   End;
  END SPGETRESULTANDSETFLAG;
  </code></pre>
  <hr />
  <h2>In Code Behind..</h2>
  <pre><code>Database db = DBSingleton.GetInstance();
  using (DbCommand command = db.GetStoredProcCommand(spName))
  {
      //The three Add In Parameters... &amp; then the Add out Parameter as below
      db.AddOutParameter(command, &quot;myFlag&quot;, System.Data.DbType.Int32, LocVariable );
      using ( IDataReader reader = db.ExecuteReader(command))
      {
           //Loop through cursor values &amp; store them in code behind class-obj(s)
      }
  }
  </code></pre>
  <hr />
  <h2>I Thought this was not possible as how do I read both the value &amp; the cursor, because..</h2>
  <p><strong>if only flag param out then</strong> i would use <em>db.ExecuteNonQuery(..)</em>
  &amp; <strong>if only cursor out then</strong> i would use <em>db.ExecuteReader(..)</em></p>