Oracle PLSQL Demo - 16.弱类型REF游标[没有指定查询类型,已指定返回类型]

declare

    Type ref_cur_variable IS REF cursor;
    cur_variable ref_cur_variable;
    rec_emp scott.emp%RowType;

    v_sql varchar2(100) := 'select * from scott.emp t';

begin

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

end;

 

posted @ 2015-06-29 23:01  nick_huang  阅读(284)  评论(0编辑  收藏  举报