DECLARE HANDLER (SQLEXCEPTION Type) | VantageCloud Lake - DECLARE HANDLER (SQLEXCEPTION Type) - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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:
  1. A statement in the stored procedure raises an exception.
  2. The generic condition handler is invoked if no handler exists to handle the specific exception condition.
  3. An SQLEXCEPTION handler runs its designated action.
  4. 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.
  5. Interaction with specific handlers varies depending on the situation.
  6. End of process.