SQLEXCEPTION is a generic condition that represents the SQLSTATE codes for all exception conditions. The handler associated with SQLEXCEPTION is invoked when an exception condition is raised during statement execution and a handler to handle the specific exception condition does not exist.
An SQLEXCEPTION handler can be written as an EXIT handler or as a CONTINUE handler.
SQLEXCEPTION Handler Actions
The following table describes the flow of control for an SQLEXCEPTION handler when activated by a raised exception:
- A statement in the stored procedure raises an exception.
- The generic condition handler is invoked if no handler exists to handle the specific exception condition.
- An SQLEXCEPTION handler runs its designated action.
- The next stage in the process depends on the handler type.
Handler Type Action CONTINUE Control passes to the next statement in the current block. EXIT Control passes to the end of the current block. - Interaction with specific handlers varies depending on the situation.
- End of process.