set serveroutput on
Declare
cursor cur1 is
Select *
from employee;
c1 cur1%rowtype;
begin
--IMPLICIT cursor
-- a Cursor with name SQL is auto-created whenever an SQL is processed
update employee
set emp_id=''
where 1=2;
--Explicit cursor
--A programmer explicitly declares it and loops through it for processing
open cur1;
loop
fetch cur1 into c1;
exit when cur1%notfound;
end loop;
dbms_output.put_line('EXPLICIT cursor has processed '||cur1%ROWCOUNT||' row(s)');
close cur1;
dbms_output.put_line('IMPLICIT cursor has processed '||SQL%ROWCOUNT||' row(s)');
end;
/
anonymous block completed
EXPLICIT cursor has processed 1005 row(s)
IMPLICIT cursor has processed 0 row(s)
Declare
cursor cur1 is
Select *
from employee;
c1 cur1%rowtype;
begin
--IMPLICIT cursor
-- a Cursor with name SQL is auto-created whenever an SQL is processed
update employee
set emp_id=''
where 1=2;
--Explicit cursor
--A programmer explicitly declares it and loops through it for processing
open cur1;
loop
fetch cur1 into c1;
exit when cur1%notfound;
end loop;
dbms_output.put_line('EXPLICIT cursor has processed '||cur1%ROWCOUNT||' row(s)');
close cur1;
dbms_output.put_line('IMPLICIT cursor has processed '||SQL%ROWCOUNT||' row(s)');
end;
/
anonymous block completed
EXPLICIT cursor has processed 1005 row(s)
IMPLICIT cursor has processed 0 row(s)
Comments