SQLSTATE Values | SQL External Routine Programming | Teradata Vantage - SQLSTATE Values - Analytics Database - Teradata Vantage

SQL External Routine Programming

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
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

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.