Nested Compound Statement Condition Handler Rules - Rules for Condition Handlers in Nested Compound Statements - Teradata Vantage - Analytics Database

SQL Stored Procedures and Embedded SQL

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
frc1628111662093.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
rjx1472253414573
lifecycle
latest
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 those described previously.

Related Information