Oracle PLSQL Demo - 08.定义显式游标[Define CURSOR, Open, Fetch, Close CURSOR]

declare
    v_empno scott.emp.empno%type;
    v_sal   scott.emp.sal%type;
    cursor cur_emp is
        select t.empno, t.sal from scott.emp t;

begin

    open cur_emp;

    loop
        fetch cur_emp
            into v_empno, v_sal;
    
        exit when cur_emp%notfound;
    
        dbms_output.put_line(v_empno || '   ' || v_sal);
    
    end loop;

    close cur_emp;

end;

 

posted @ 2015-06-29 22:53  nick_huang  阅读(289)  评论(0编辑  收藏  举报