Is it possible to execute c_emp%notfound after the following FOR loop or do I have to open the cursor first?
declare
cursor c_emp is select * from employee;
begin
for c_rec in c_emp
loop
dbms_output.put_line(r_emp.first_Name);
end loop;
end;
/
I want to execute a statement a single UPDATE statement after the FOR loop but only if the FOR loop did process any of the rows on the cursor. I know i can set a flag but is there a cleaner way?
No, that’s going to hurl
ORA-01001: invalid cursor. The cursor attributes only have scope while the cursor is open, which in this syntax is between theFORand theEND LOOP.This is an ugly aspect of PL/SQL but I’m afraid you’re stuck with a count.