title: Using Oracle's with inside procedure with sys_refcursor
body: <p>I'm trying to execute a procedure that returns a <code>sys_refcursor</code>, and I want to use a with command to get the cursor, but I get an error when I execute the proc. Is it possible? Below is the proc:</p>
  
  <pre><code>create or replace
  procedure sp_proc(
    p_vl_skip in number,
    p_vl_take in number,
    tblresult out sys_refcursor)
  as
    v_first_row number;
    v_last_row number;
  begin
    select p_vl_skip into v_first_row from dual;
    select p_vl_skip + p_vl_take into v_last_row from dual;
  
    open tblresult for
    with tbl_relacao_rejeicoes as (
      select vl_value1, vl_value2, row_number() over (order by vl_value1 desc) vl_reg
      from tb_table
      order by vl_value1 desc)
    select *
    from tbl_relacao_rejeicoes
    where vl_reg between v_first_row and v_last_row
    order by cd_motivo_rejeicao vl_value1;
  end;
  /
  </code></pre>
  
  <p>It compiles without any logs, but when I execute it, I get:</p>
  
  <pre><code>OracleException: ORA-06550: line 1, column 7:
  PLS-00201: identifier 'TBL_RELACAO_REJEICOES' must be declared
  ORA-06550: line 1, column 7:
  PL/SQL: Statement ignored
  </code></pre>