I would like to replace the following open/fetch/close statements with a cursor FOR loop, but I need to check for this particular DB2 error on every fetch, and I don't know how to do that error checking inside the FOR loop. Any help is appreciated.
*****************************************
cursor c1 is select ..........
e_DB2_error EXCEPTION;
PRAGMA EXCEPTION_INIT (e_DB2_error, -9100);
begin
open c1 cursor;
begin
fetch c1 into .....local variables;
exception
WHEN e_DB2_error THEN
etc. etc.
end;
while c1%found
loop
/* process rows... */
/* fetch the next row of the cursor */
begin
fetch c1 into .....local variables;
exception
WHEN e_DB2_error THEN
etc. etc.
end;
end loop;
close c1 cursor;
end;
************************************