游标的属性决定游标操作(如果打开或者检索游标)的结果。
%notfound cursor_name%notfound 一个boolean属性,当前面的fetch操作没有返回数据时,该属性的值是ture,否则是false
%found cursor_name%found 一个boolean属性,当前面的fetch操作返回一行数据时,该属性的值是TURE,否则是false
%rowcount cursor_name%rowcount 从游标中检索的记录数量
%ISOPEN cursor_name%isopen 一个boolean属性,当游标处于打开状态时,则属性的值是true,否则是false
示例:
create table tab_log ( description varchar2(250));
运行如下脚本:
declare
cur_stu is
select stu_id,last_name,frist_name
from stu
where stu_id< 100;
begin
for r_stu in c_stu
loop
insert into tab_log
values(r_stu.last_name);
end loop;
end;
注:使用游标for偱环时,是不需要声明变量,你可以认为 for 变量 into 游标名