declare

    Type ref_cur_variable IS REF cursor;
    cur_variable ref_cur_variable;
    v_empno scott.emp.empno%type;
    v_ename scott.emp.ename%type;

    v_sql varchar2(100) := 'select t.empno, t.ename from scott.emp t';

begin

    Open cur_variable For v_sql;
    
    Loop
        fetch cur_variable
            InTo v_empno, v_ename;
        Exit When cur_variable%NotFound;
        dbms_output.put_line(cur_variable%rowcount || ' -> ' || v_empno ||
                             '   ' || v_ename);
    End Loop;
    Close cur_variable;

end;

 

相关文章:

  • 2021-09-10
  • 2021-08-24
  • 2021-08-03
  • 2021-12-06
  • 2022-03-10
  • 2022-02-26
  • 2021-10-25
  • 2022-12-23
猜你喜欢
  • 2021-04-03
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2021-07-01
  • 2021-11-11
相关资源
相似解决方案