condition_handler - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

You can specify these options for a condition handler.

CONTINUE
EXIT
Type of condition handler being requested. For details, see these topics:
SQLSTATE
Keyword introducing an sqlstate value for which the exception or completion condition is to be handled.
You can specify any number of sqlstate values prefixed by SQLSTATE or SQLSTATE VALUE in a comma-separated list within each handler declaration.
VALUE
Optional keyword prefixing the sqlstate value.
sqlstate_code
Five-character string value that indicates a completion condition for the SQL statement. This is delimited by APOSTROPHE characters.
A given sqlstate value cannot be a part of more than one DECLARE HANDLER statements and cannot be repeated within a FOR clause.
SQLEXCEPTION
A keyword identifier for generic conditions.
You can specify these individually or in combination, but you cannot specify any of them more than once within a given DECLARE HANDLER statement.
SQLEXCEPTION indicates a generic exception condition.
SQLWARNING
SQLWARNING indicates a generic completion condition.
NOT FOUND
NOT FOUND indicates a generic completion condition when no data is found.
condition_name
condition_name is a name that can be used to specify conditions for a handler to act on when the procedure definition specifies the condition name in a SIGNAL or RESIGNAL statement.
handler_action_statement
A single or compound statement that performs the handler action.
A single statement can be any one of the following:
  • Any standard SQL statement, including dynamic SQL, supported by SQL procedures.
  • Any SQL control statement.
The following are not valid as a single statement for handler_action_statement:
  • Local variables
  • Cursors
  • Handler declarations