SQLSTATE Codes | Teradata Vantage - SQLSTATE Codes - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
xqq1557098602407.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantage™

Definition

SQLSTATE codes are status values in embedded SQL programs and stored procedures that reflect the status of an SQL statement execution.

Unlike SQLCODE codes, which are integer values, SQLSTATE codes are character strings. Because of this, they are always displayed in apostrophes as in the following sample SQLSTATE value: ‘xxxxx’.

The characters of an SQLSTATE code are divided logically into two categories:
  • A 2-character class value.

    The first two characters of the SQLSTATE code are any one of the ANSI/ISO SQL-99-defined SQLSTATE classes (see SQLSTATE Class Definitions).

  • A 3-character subclass value.

    Subclass values can be any numeric or simple uppercase LATIN character string.

SQLSTATE Code Values

Successful completion of an SQL request with warning code = 0 returns the SQLSTATE code value ‘00000’.

For all other situations, see Mapping Teradata Database Error Messages to SQLSTATE Values

SQLSTATE Class Definitions

ANSI defines the SQLSTATE class definitions provided in the following table. Teradata Database does not support all the classes listed.

Class Code Definition
00 Successful completion
01 Warning
02 No data found
03 SQL statement not yet complete
07 Dynamic SQL error
08 Connection exception
09 Triggered action exception
0A Unsupported feature
0B Nonvalid transaction initiation
0D Nonvalid target type specification
0E Nonvalid schema name list specification
0F Locator exception
0K Resignal when handler not active
0L Nonvalid grammar
0M Nonvalid SQL-invoked procedure reference
0N SQL/XML mapping error
0P Nonvalid role specification
0S Nonvalid transform group name specification
0T Target table disagrees with cursor specification
0U Attempt to assign to nonupdatable column
0V Attempt to assign to ordering column
0W Prohibited statement encountered during trigger execution
0X Nonvalid foreign server specification
0Y Pass-through specific condition
20 Case not found for case statement
21 Cardinality violation
22 Data exception
23 Constraint violation
24 Nonvalid cursor state
25 Nonvalid transaction state
26 Nonvalid statement name
27 Triggered data change violation
28 Nonvalid authorization ID specification
Teradata SQL does not directly support the ANSI concept of an authorization ID. The ANSI authorization ID is essentially a Teradata Database user.
2B Dependent privilege descriptors still exist
2C Nonvalid character set name
2D Nonvalid transaction termination
2E Nonvalid connection name
2F SQL routine exception
30 Nonvalid SQL statement
31 Nonvalid target specification value
33 Nonvalid SQLDA name
34 Nonvalid cursor name
35 Nonvalid condition number
36 Cursor sensitivity exception
38 External routine exception
39 External routine invocation exception
3B Savepoint exception
3C Ambiguous cursor name
3D Nonvalid catalog name
Teradata SQL does not directly support the ANSI concept of a catalog. The ANSI catalog is essentially the same thing as the Teradata Database data dictionary.
3F Nonvalid schema name
Teradata SQL does not directly support the ANSI concept of a catalog. The ANSI catalog is essentially the same thing as the Teradata Database data dictionary.
40 Transaction rollback
42 Syntax error or access rule violation
44 With check option violation
45 Unhandled user-defined exception
46 Java DDL or Java execution
HV Foreign data wrapper-specific condition
HW Datalink exception
HY Call-Level Interface condition
The Call-Level Interface referred to is not the Teradata Database CLIv2, but rather an ANSI-standard CLI that is a dialect of the Microsoft Open Database Connectivity, or ODBC, specification.
HZ Remote database access condition
U0 User-defined exception