plsql/cursors handle exception and return back to the execution flow
Put the code that you want to execute within the loop in it's own block and then you can use that blocks exception section to handle any problems during the loop iteration.
Once the exception for that iteration is handled, the next loop iteration will start
e.g.:
for line in my_cursor
loop
begin
<<do_something>>
exception
<<do_exception_processing>>
end;
end loop;
To illustrate this further, in the example below, I have declared a local variable of type exception. I am looping through numbers 1 to 10, during the second loop iteration, the if statement is true and processing passes to the exception handler. Once the exception is handled, the next iteration of the loop begins.
begin
for i in 1 .. 10
loop
declare
my_exception exception;
begin
if i = 2
then
-- if you need to do some processing then you would enter it
-- here and then when you want to enter the exception section
-- you would add the line below
raise my_exception;
end if;
exception
when my_exception then
dbms_output.put_line('in exception section');
end;
end loop;
end;
FOR line IN my_cursor
LOOP
if not some_condition then
begin
do_something;
exception
when others then log_my_error(); -- this should be something that uses
-- an autonomous transaction
end;
end if;
END LOOP;