condition_handler - Analytics Database - Teradata Vantage

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

You can specify these options for a condition handler.

CONTINUE
EXIT
Type of condition handler being requested.
See Teradata Vantage™ - SQL Data Definition Language Detailed Topics, B035-1184 and Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148 for details.
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 always 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 with one another, 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