17.00 - condition_handler - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Advanced SQL Engine
Teradata Database
Release Number
Release Date
September 2020
Content Type
Programming Reference
Publication ID
English (United States)

You can specify these options for a condition handler.

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.
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.
Optional keyword prefixing the sqlstate value.
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.
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 indicates a generic completion condition.
NOT FOUND indicates a generic completion condition when no data is found.
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.
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