Changing Error-handling Routines
Go Up to WHENEVER Statements
To switch to another error-handling routine for a particular error condition, embed another WHENEVER statement in the program at the point where error handling should be changed. The new assignment overrides any previous assignment, and remains in effect until overridden itself. For example, the following program fragment sets an initial jump point for SQLERROR conditions to ErrorExit1, then resets it to ErrorExit2:
EXEC SQL WHENEVER SQLERROR GOTO ErrorExit1; . . . EXEC SQL WHENEVER SQLERROR GOTO ErrorExit2; . . .