condition_handler - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
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