Nested Compound Statement Condition Handler Rules - Rules for Condition Handlers in Nested Compound Statements - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
xqq1557098602407.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantage™
  • Exceptions, completion, and user-defined conditions raised in a compound statement by any statement other than handler action statements are handled within that compound statement if an appropriate handler exists.

    In nested compound statements, conditions that find no suitable handler in an inner compound statement are propagated to the outer statement in search of a handler.

    The different scenarios possible when no handler is available to handle a particular condition in an inner compound statement, are described in the following table:

    IF a condition is raised … AND an appropriate handler… THEN …
    in a non-nested compound statement exists in that statement the condition is handled and the stored procedure execution either continues or terminates based on the type of handler.
    does not exist and the condition is:
    • an exception or unhandled user-defined condition
    • a completion condition
    • the stored procedure terminates.
    • the stored procedure execution continues.
    • in a nested compound statement, or
    • by a statement other than a handler action statement
    exists within that statement the condition is handled.
    does not exist within that statement, then the immediate outer statement is searched for a suitable handler.
    • If a handler exists within that statement, the condition is handled.
    • If no handler exists, the next outer compound statement is searched for a suitable handler.

    If no appropriate handler exists in the outermost compound statement and the condition is:

    • an exception or unhandled user-defined condition, the stored procedure terminates.
    • a completion condition, the stored procedure execution continues with the statement following the statement that caused the condition.
  • The rules for propagation and handling of exception, completion and user-defined conditions raised by any handler action statement are different from the above.

Related Topics

For more information about: