SQLSTATE Values | SQL External Routine Programming | Teradata Vantage - 17.10 - SQLSTATE Values - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

The first five characters of the sqlstate output character string have a format of 'ccsss', where cc is the class and sss is the subclass. The last character of the string is a binary 0, or C string terminator. The following table shows some of the more useful valid settings that a UDF can return for the SQLSTATE result code.

Category Class Condition Subclass Sub-condition
Success 00 No error. 000 None.
02 No data. 000 None.
Warning 01 Warning. H xx External routine warning

where you choose the value of xx.

Exception 38 External routine exception. 000 None.
002 Invalid return value for predicate.
39 External routine invocation exception. 000 None.
001 Invalid SQLSTATE returned. This error indicates the function returns a bad SQLSTATE.
002 Null value not allowed.
22 Data exception. 000 None.
021 Character not in repertoire.
008 Datetime field overflow.
012 Division by zero.
005 Error in assignment.
022 Indicator overflow.
015 Interval field overflow.
018 Invalid datetime format.
019 Invalid escape character.
025 Invalid escape sequence.
010 Invalid indicator parameter value.
020 Invalid limit value.
023 Invalid parameter value.
002 Null value, no indicator parameter.
003 Numeric value out of range.
004 Null value not allowed.
026 String data length mismatch.
001 String data, right truncation.
027 Trim error.
024 Unterminated C string.
00F Zero-length C string.
  U0 User-defined data exception. xxx User-defined exception

where you choose the value of xxx.