title: Retrieve a select count(*) in Oracle inside a cursor
body: <p>I need to retrieve the number of rows in a SELECT COUNT(*) statement that is inside a cursor (in Oracle).</p>
  
  <p>The following code should explain it clearly:</p>
  
  <pre><code>PROCEDURE Save(CF_CURSOR OUT "VPA"."CF_#Runtime".CF_CURSOR_TYPE) AS
      V_CF_CURSOR "VPA"."CF_#Runtime".CF_CURSOR_TYPE;
      CF_ROWCOUNT NUMBER;
      BEGIN
          OPEN V_CF_CURSOR FOR
          SELECT COUNT(*) INTO CF_ROWCOUNT FROM (
              SELECT * FROM "VPA"."Employee" -- returns 1 row
          ) WHERE ROWNUM &lt;= 1;
          IF(CF_ROWCOUNT = 0) THEN
              -- DO SOMETHING BUT NEVER GOES HERE
          END IF;
          COMMIT;
      CF_CURSOR := V_CF_CURSOR;
      END;
  </code></pre>
  
  <p>Here, the value of CF_ROWCOUNT is never set. If I remove the cursor, everything works as expected. I have tried to use SQL%ROWCOUNT, but it does not work either.
  And, I cannot remove the cursor...</p>
  
  <p>Thanks in advance!</p>