当前位置:Gxlcms >
数据库问题 >
Oracle PLSQL Demo - 13.游标的各种属性[Found NotFound ISOpen RowCount CURSOR]
Oracle PLSQL Demo - 13.游标的各种属性[Found NotFound ISOpen RowCount CURSOR]
时间:2021-07-01 10:21:17
帮助过:4人阅读
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]
标签: