title: PL/SQL Static cursor variable as ref cursor
body: <p>I have a procedure that takes a SYS_REFCURSOR and converts it to JSON.</p>
  
  <p>In a procedure that calls the above, I'm trying define a CURSOR as normal and supply that as a REF CURSOR.</p>
  
  <p>I'm receiving PLS-00361.</p>
  
  <p>I understand that I can use the OPEN FOR construct, but I need to use my Cursor elsewhere and don't like the duplication.</p>
  
  <p>Any advice?</p>
  
  <pre><code>  PROCEDURE LIST_EMPLOYEES 
    AS
  
      l_ref_cursor SYS_REFCURSOR;
  
      CURSOR c_emps
      IS
      SELECT email_address
        FROM employees;
  
    BEGIN
  
      OPEN c_emps;
      FETCH c_emps INTO l_ref_cursor;
  
      json_utils.refcursor_to_json_via_http(l_ref_cursor,
                                            'employees');
  
      CLOSE l_ref_cursor;
  
    EXCEPTION
    WHEN others
    THEN
      log_error;
    END LIST_EMPLOYEES;
  </code></pre>
  
  <p>Regards,
  Laurence.</p>