Given the following example
cursor test_cursor is
select *
from authors;
open test_cursor;
if (test_cursor%rowcount = 0) then
raise no_data;
else
close test_cursor;
for test_cursor_rec in test_cursor
loop
update authors
set id="21"
commit;
end loop
end if;
The above code example, selects everything into a cursor and loops through the cursor to update rows that are in the authors table. This is the same data that is on the cursor. I have been getting "snapshot too old" errors and reading about this error i concluded that the commit statement is causing this as i am making changes to the data which the cursor is using.
What is the alternative way to do this to avoid the "snapshot too old" errrors. ?
Thanks