Forcing Continuation of the Routine

The first example in Placement of the ON EXCEPTION statement includes the WITH RESUME keyword to specify that if the ON EXCEPTION statement traps an error, execution of the FOREACH loop resumes on the next row of the cs_insert cursor, the row immediately following the row on which the error was raised. If an error is issued on the last row of the active set, the procedure exits. After procedure X completes execution, table B contains a copy of every customer number in table A on which no error was issued during the INSERT operation.

The second example in Placement of the ON EXCEPTION statement uses the WITH RESUME keyword to indicate that after the statement block in the ON EXCEPTION statement executes, execution is to continue at the SELECT COUNT(*) FROM emp_list statement, which is the line following the line that raised the error. For this function, the result is that the count of salespeople names occurs even if the error occurred.