Cursor Attribute
Explicit Cursor attribute :-
1) c1%isopen
2) c1%found
3) c1%notfound
4) c1%rowcount
Implicit Cursor attribute :-
1) sql%isopen
2) sql%found
3) sql%notfound
4) sql%rowcount
More Examples of cursors with cursor attribute:-
declare
cursor c1 is select sal from emp;
vsal emp.sal%type;
begin
open c1;
loop
fetch c1 into vsal;
exit when c1%notfound;
dbms_output.put_line(vsal);
end loop;
dbms_output.put_line('Processed records:-'||c1%rowcount);
close c1;
end;
/
declare
cursor c1 is select ename from emp where deptno=&dno;
v emp.ename%type;
begin
open c1;
loop
fetch c1 into v;
exit when c1%notfound;
dbms_output.put_line(v);
end loop;
dbms_output.put_line('Processed records:-'||c1%rowcount);
close c1;
end;
/
No comments:
Post a Comment