首页 > 数据库技术 > 详细

Oracle PLSQL Demo - 13.游标的各种属性[Found NotFound ISOpen RowCount CURSOR]

时间:2015-06-29 23:36:19      阅读:323      评论:0      收藏:0      [点我收藏+]
declare
    r_emp scott.emp%rowtype;
    cursor cur_emp is
        select t.* from scott.emp t;

begin

    open cur_emp;

    if cur_emp%isopen then
        dbms_output.put_line(is open...);
    end if;

    loop
        fetch cur_emp
            into r_emp;
    
        if cur_emp%found then
            dbms_output.put_line(found...);
        end if;
    
        if cur_emp%notfound then
            dbms_output.put_line(not found...);
        end if;
    
        exit when cur_emp%notfound;
    
        dbms_output.put_line(cur_emp%rowcount ||  ->  || r_emp.empno ||
                                 || r_emp.sal);
    
    end loop;

    close cur_emp;

end;

 

Oracle PLSQL Demo - 13.游标的各种属性[Found NotFound ISOpen RowCount CURSOR]

原文:http://www.cnblogs.com/nick-huang/p/4609089.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!