SQLSTATE

Last updated

Programs calling a database which accords to the SQL standard receive an indication about the success or failure of the call. This return code - which is called SQLSTATE - consists of 5 bytes. They are divided into two parts: the first and second bytes contain a class and the following three a subclass. Each class belongs to one of four categories: "S" denotes "Success" (class 00), "W" denotes "Warning" (class 01), "N" denotes "No data" (class 02) and "X" denotes "Exception" (all other classes).

The following table lists the standard-conforming values - based on SQL:2011. [1] The table's last column shows the part of the standard that defines the row. If it is empty, the definition originates from part 2 Foundation.

SQLSTATECat.ClassClass TextSubclassSubclass TextSQL part
00000S00successful completion000(no subclass)
01000W01warning000(no subclass)
01001W01warning001cursor operation conflict
01002W01warning002disconnect error
01003W01warning003null value eliminated in set function
01004W01warning004string data, right truncation
01005W01warning005insufficient item descriptor areas
01006W01warning006privilege not revoked
01007W01warning007privilege not granted
01009W01warning009search condition too long for information schema
0100AW01warning00Aquery expression too long for information schema
0100BW01warning00Bdefault value too long for information schema
0100CW01warning00Cresult sets returned
0100DW01warning00Dadditional result sets returned
0100EW01warning00Eattempt to return too many result sets
0100FW01warning00Fstatement too long for information schema
01010W01warning010column cannot be mapped SQL/XML
01011W01warning011SQL-Java path too long for information schema SQL/JRT
01012W01warning012invalid number of conditions
0102FW01warning02Farray data, right truncation
02000N02no data000(no subclass)
02001N02no data001no additional result sets returned
07000X07dynamic SQL error000(no subclass)
07001X07dynamic SQL error001using clause does not match dynamic parameter specifications
07002X07dynamic SQL error002using clause does not match target specifications
07003X07dynamic SQL error003cursor specification cannot be executed
07004X07dynamic SQL error004using clause required for dynamic parameters
07005X07dynamic SQL error005prepared statement not a cursor specification
07006X07dynamic SQL error006restricted data type attribute violation
07007X07dynamic SQL error007using clause required for result fields
07008X07dynamic SQL error008invalid descriptor count
07009X07dynamic SQL error009invalid descriptor index
0700BX07dynamic SQL error00Bdata type transform function violation
0700CX07dynamic SQL error00Cundefined DATA value
0700DX07dynamic SQL error00Dinvalid DATA target
0700EX07dynamic SQL error00Einvalid LEVEL value
0700FX07dynamic SQL error00Finvalid DATETIME_INTERVAL_CODE
08000X08connection exception000(no subclass)
08001X08connection exception001SQL-client unable to establish SQL-connection
08002X08connection exception002connection name in use
08003X08connection exception003connection does not exist
08004X08connection exception004SQL-server rejected establishment of SQL-connection
08006X08connection exception006connection failure
08007X08connection exception007transaction resolution unknown
09000X09triggered action exception000(no subclass)
0A000X0Afeature not supported000(no subclass)
0A001X0Afeature not supported001multiple server transactions
0D000X0Dinvalid target type specification000(no subclass)
0E000X0Einvalid schema name list specification000(no subclass)
0F000X0Flocator exception000(no subclass)
0F001X0Flocator exception001invalid specification
0K000X0Kresignal when handler not active000(no subclass) SQL/PSM
0L000X0Linvalid grantor000(no subclass)
0M000X0Minvalid SQL-invoked procedure reference000(no subclass)
0N000X0NSQL/XML mapping error000(no subclass) SQL/XML
0N001X0NSQL/XML mapping error001unmappable XML name SQL/XML
0N002X0NSQL/XML mapping error002invalid XML character SQL/XML
0P000X0Pinvalid role specification000(no subclass)
0S000X0Sinvalid transform group name specification000(no subclass)
0T000X0Ttarget table disagrees with cursor specification000(no subclass)
0U000X0Uattempt to assign to non-updatable column000(no subclass)
0V000X0Vattempt to assign to ordering column000(no subclass)
0W000X0Wprohibited statement encountered during trigger execution000(no subclass)
0W001X0Wprohibited statement encountered during trigger execution001modify table modified by data change delta table
0X000X0Xinvalid foreign server specification000(no subclass) SQL/MED
0Y000X0Ypass-through specific condition000(no subclass) SQL/MED
0Y001X0Ypass-through specific condition001invalid cursor option SQL/MED
0Y002X0Ypass-through specific condition002invalid cursor allocation SQL/MED
0Z000X0Zdiagnostics exception000(no subclass)
0Z001X0Zdiagnostics exception001maximum number of stacked diagnostics areas exceeded
0Z002X0Zdiagnostics exception002stacked diagnostics accessed without active handler SQL/PSM
10000X10XQuery error000(no subclass) SQL/XML
20000X20case not found for case statement000(no subclass) SQL/PSM
21000X21cardinality violation000(no subclass)
22000X22data exception000(no subclass)
22001X22data exception001string data, right truncation
22002X22data exception002null value, no indicator parameter
22003X22data exception003numeric value out of range
22004X22data exception004null value not allowed
22005X22data exception005error in assignment
22006X22data exception006invalid interval format
22007X22data exception007invalid datetime format
22008X22data exception008datetime field overflow
22009X22data exception009invalid time zone displacement value
2200BX22data exception00Bescape character conflict
2200CX22data exception00Cinvalid use of escape character
2200DX22data exception00Dinvalid escape octet
2200EX22data exception00Enull value in array target
2200FX22data exception00Fzero-length character string
2200GX22data exception00Gmost specific type mismatch
2200HX22data exception00Hsequence generator limit exceeded
2200JX22data exception00Jnonidentical notations with the same name SQL/XML
2200KX22data exception00Knonidentical unparsed entities with the same name SQL/XML
2200LX22data exception00Lnot an XML document SQL/XML
2200MX22data exception00Minvalid XML document SQL/XML
2200NX22data exception00Ninvalid XML content SQL/XML
2200PX22data exception00Pinterval value out of range
2200QX22data exception00Qmultiset value overflow
2200RX22data exception00RXML value overflow SQL/XML
2200SX22data exception00Sinvalid comment SQL/XML
2200TX22data exception00Tinvalid processing instruction SQL/XML
2200UX22data exception00Unot an XQuery document node SQL/XML
2200VX22data exception00Vinvalid XQuery context item SQL/XML
2200WX22data exception00WXQuery serialization error SQL/XML
22010X22data exception010invalid indicator parameter value
22011X22data exception011substring error
22012X22data exception012division by zero
22013X22data exception013invalid preceding or following size in window function
22014X22data exception014invalid argument for NTILE function
22015X22data exception015interval field overflow
22016X22data exception016invalid argument for NTH_VALUE function
22017X22data exception017invalid data specified for datalink SQL/MED
22018X22data exception018invalid character value for cast
22019X22data exception019invalid escape character
2201AX22data exception01Anull argument passed to datalink constructor SQL/MED
2201BX22data exception01Binvalid regular expression
2201CX22data exception01Cnull row not permitted in table
2201DX22data exception01Ddatalink value exceeds maximum length SQL/MED
2201EX22data exception01Einvalid argument for natural logarithm
2201FX22data exception01Finvalid argument for power function
2201GX22data exception01Ginvalid argument for width bucket function
2201HX22data exception01Hinvalid row version
2201JX22data exception01JXQuery sequence cannot be validated SQL/XML
2201KX22data exception01KXQuery document node cannot be validated SQL/XML
2201LX22data exception01Lno XML schema found SQL/XML
2201MX22data exception01Melement namespace not declared SQL/XML
2201NX22data exception01Nglobal element not declared SQL/XML
2201PX22data exception01Pno XML element with the specified QName SQL/XML
2201QX22data exception01Qno XML element with the specified namespace SQL/XML
2201RX22data exception01Rvalidation failure SQL/XML
2201SX22data exception01Sinvalid Query regular expression
2201TX22data exception01Tinvalid Query option flag
2201UX22data exception01Uattempt to replace a zero-length string
2201VX22data exception01Vinvalid Query replacement string
2201WX22data exception01Winvalid row count in fetch first clause
2201XX22data exception01Xinvalid row count in result offset clause
22021X22data exception021character not in repertoire
22022X22data exception022indicator overflow
22023X22data exception023invalid parameter value
22024X22data exception024unterminated C string
22025X22data exception025invalid escape sequence
22026X22data exception026string data, length mismatch
22027X22data exception027trim error
22029X22data exception029noncharacter in UCS string
2202AX22data exception02Anull value in field reference SQL/PSM
2202DX22data exception02Dnull value substituted for mutator subject parameter
2202EX22data exception02Earray element error
2202FX22data exception02Farray data, right truncation
2202GX22data exception02Ginvalid repeat argument in a sample clause
2202HX22data exception02Hinvalid sample size
23000X23integrity constraint violation000(no subclass)
23001X23integrity constraint violation001restrict violation
24000X24invalid cursor state000(no subclass)
25000X25invalid transaction state000(no subclass)
25001X25invalid transaction state001active SQL-transaction
25002X25invalid transaction state002branch transaction already active
25003X25invalid transaction state003inappropriate access mode for branch transaction
25004X25invalid transaction state004inappropriate isolation level for branch transaction
25005X25invalid transaction state005no active SQL-transaction for branch transaction
25006X25invalid transaction state006read-only SQL-transaction
25007X25invalid transaction state007schema and data statement mixing not supported
25008X25invalid transaction state008held cursor requires same isolation level
26000X26invalid SQL statement name000(no subclass)
27000X27triggered data change violation000(no subclass)
27001X27triggered data change violation001modify table modified by data change delta table
28000X28invalid authorization specification000(no subclass)
2B000X2Bdependent privilege descriptors still exist000(no subclass)
2C000X2Cinvalid character set name000(no subclass)
2D000X2Dinvalid transaction termination000(no subclass)
2E000X2Einvalid connection name000(no subclass)
2F000X2FSQL routine exception000(no subclass)
2F002X2FSQL routine exception002modifying SQL-data not permitted
2F003X2FSQL routine exception003prohibited SQL-statement attempted
2F004X2FSQL routine exception004reading SQL-data not permitted
2F005X2FSQL routine exception005function executed no return statement
2H000X2Hinvalid collation name000(no subclass)
30000X30invalid SQL statement identifier000(no subclass)
33000X33invalid SQL descriptor name000(no subclass)
34000X34invalid cursor name000(no subclass)
35000X35invalid condition number000(no subclass)
36000X36cursor sensitivity exception000(no subclass)
36001X36cursor sensitivity exception001request rejected
36002X36cursor sensitivity exception002request failed
38000X38external routine exception000(no subclass)
38001X38external routine exception001containing SQL not permitted
38002X38external routine exception002modifying SQL-data not permitted
38003X38external routine exception003prohibited SQL-statement attempted
38004X38external routine exception004reading SQL-data not permitted
39000X39external routine invocation exception000(no subclass)
39004X39external routine invocation exception004null value not allowed
3B000X3Bsavepoint exception000(no subclass)
3B001X3Bsavepoint exception001invalid specification
3B002X3Bsavepoint exception002too many
3C000X3Cambiguous cursor name000(no subclass)
3D000X3Dinvalid catalog name000(no subclass)
3F000X3Finvalid schema name000(no subclass)
40000X40transaction rollback000(no subclass)
40001X40transaction rollback001serialization failure
40002X40transaction rollback002integrity constraint violation
40003X40transaction rollback003statement completion unknown
40004X40transaction rollback004triggered action exception
42000X42syntax error or access rule violation000(no subclass)
44000X44with check option violation000(no subclass)
45000X45unhandled user-defined exception000(no subclass) SQL/PSM
46000X46OLB-specific error000(no subclass) SQL/OLB
46001X46Java DDL001invalid URL SQL/JRT
46002X46Java DDL002invalid JAR name SQL/JRT
46003X46Java DDL003invalid class deletion SQL/JRT
46005X46Java DDL005invalid replacement SQL/JRT
4600AX46Java DDL00Aattempt to replace uninstalled JAR SQL/JRT
4600BX46Java DDL00Battempt to remove uninstalled JAR SQL/JRT
4600CX46Java DDL00Cinvalid JAR removal SQL/JRT
4600DX46Java DDL00Dinvalid path SQL/JRT
4600EX46Java DDL00Eself-referencing path SQL/JRT
46102X46Java DDL102invalid JAR name in path SQL/JRT
46103X46Java DDL103unresolved class name SQL/JRT
46110X46OLB-specific error110unsupported feature SQL/OLB
46120X46OLB-specific error120invalid class declaration SQL/OLB
46121X46OLB-specific error121invalid column name SQL/OLB
46122X46OLB-specific error122invalid number of columns SQL/OLB
46130X46OLB-specific error130invalid profile state SQL/OLB
HW000XHWdatalink exception000(no subclass) SQL/MED
HW001XHWdatalink exception001external file not linked SQL/MED
HW002XHWdatalink exception002external file already linked SQL/MED
HW003XHWdatalink exception003referenced file does not exist SQL/MED
HW004XHWdatalink exception004invalid write token SQL/MED
HW005XHWdatalink exception005invalid datalink construction SQL/MED
HW006XHWdatalink exception006invalid write permission for update SQL/MED
HW007XHWdatalink exception007referenced file not valid SQL/MED
HV000XHVFDW-specific condition000(no subclass) SQL/MED
HV001XHVFDW-specific condition001memory allocation error SQL/MED
HV002XHVFDW-specific condition002dynamic parameter value needed SQL/MED
HV004XHVFDW-specific condition004invalid data type SQL/MED
HV005XHVFDW-specific condition005column name not found SQL/MED
HV006XHVFDW-specific condition006invalid data type descriptors SQL/MED
HV007XHVFDW-specific condition007invalid column name SQL/MED
HV008XHVFDW-specific condition008invalid column number SQL/MED
HV009XHVFDW-specific condition009invalid use of null pointer SQL/MED
HV00AXHVFDW-specific condition00Ainvalid string format SQL/MED
HV00BXHVFDW-specific condition00Binvalid handle SQL/MED
HV00CXHVFDW-specific condition00Cinvalid option index SQL/MED
HV00DXHVFDW-specific condition00Dinvalid option name SQL/MED
HV00JXHVFDW-specific condition00Joption name not found SQL/MED
HV00KXHVFDW-specific condition00Kreply handle SQL/MED
HV00LXHVFDW-specific condition00Lunable to create execution SQL/MED
HV00MXHVFDW-specific condition00Munable to create reply SQL/MED
HV00NXHVFDW-specific condition00Nunable to establish connection SQL/MED
HV00PXHVFDW-specific condition00Pno schemas SQL/MED
HV00QXHVFDW-specific condition00Qschema not found SQL/MED
HV00RXHVFDW-specific condition00Rtable not found SQL/MED
HV010XHVFDW-specific condition010function sequence error SQL/MED
HV014XHVFDW-specific condition014limit on number of handles exceeded SQL/MED
HV021XHVFDW-specific condition021inconsistent descriptor information SQL/MED
HV024XHVFDW-specific condition024invalid attribute value SQL/MED
HV090XHVFDW-specific condition090invalid string length or buffer length SQL/MED
HV091XHVFDW-specific condition091invalid descriptor field identifier SQL/MED
HY000XHYCLI-specific condition000(no subclass) SQL/CLI
HY???XHYCLI-specific conditionn/adynamic parameter value needed SQL/CLI
HY???XHYCLI-specific conditionn/ainvalid handle SQL/CLI
HY001XHYCLI-specific condition001memory allocation error SQL/CLI
HY003XHYCLI-specific condition003invalid data type in application descriptor SQL/CLI
HY004XHYCLI-specific condition004invalid data type SQL/CLI
HY007XHYCLI-specific condition007associated statement is not prepared SQL/CLI
HY008XHYCLI-specific condition008operation canceled SQL/CLI
HY009XHYCLI-specific condition009invalid use of null pointer SQL/CLI
HY010XHYCLI-specific condition010function sequence error SQL/CLI
HY011XHYCLI-specific condition011attribute cannot be set now SQL/CLI
HY012XHYCLI-specific condition012invalid transaction operation code SQL/CLI
HY013XHYCLI-specific condition013memory management error SQL/CLI
HY014XHYCLI-specific condition014limit on number of handles exceeded SQL/CLI
HY017XHYCLI-specific condition017invalid use of automatically allocated descriptor handle SQL/CLI
HY018XHYCLI-specific condition018server declined the cancellation request SQL/CLI
HY019XHYCLI-specific condition019non-string data cannot be sent in pieces SQL/CLI
HY020XHYCLI-specific condition020attempt to concatenate a null value SQL/CLI
HY021XHYCLI-specific condition021inconsistent descriptor information SQL/CLI
HY024XHYCLI-specific condition024invalid attribute value SQL/CLI
HY055XHYCLI-specific condition055non-string data cannot be used with string routine SQL/CLI
HY090XHYCLI-specific condition090invalid string length or buffer length SQL/CLI
HY091XHYCLI-specific condition091invalid descriptor field identifier SQL/CLI
HY092XHYCLI-specific condition092invalid attribute identifier SQL/CLI
HY093XHYCLI-specific condition093invalid datalink value SQL/MED
HY095XHYCLI-specific condition095invalid FunctionId specified SQL/CLI
HY096XHYCLI-specific condition096invalid information type SQL/CLI
HY097XHYCLI-specific condition097column type out of range SQL/CLI
HY098XHYCLI-specific condition098scope out of range SQL/CLI
HY099XHYCLI-specific condition099nullable type out of range SQL/CLI
HY103XHYCLI-specific condition103invalid retrieval code SQL/CLI
HY104XHYCLI-specific condition104invalid LengthPrecision value SQL/CLI
HY105XHYCLI-specific condition105invalid parameter mode SQL/CLI
HY106XHYCLI-specific condition106invalid fetch orientation SQL/CLI
HY107XHYCLI-specific condition107row value out of range SQL/CLI
HY108XHYCLI-specific condition108invalid cursor position SQL/CLI
HYC00XHYCLI-specific conditionC00optional feature not implemented SQL/CLI
HZ??? ?HZReserved for ISO9579 (RDA) ???

Related Research Articles

<span class="mw-page-title-main">Smalltalk</span> Object-oriented programming language first released in 1972

Smalltalk is an object-oriented, dynamically typed reflective programming language. It was designed and created in part for educational use, specifically for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Diana Merry, Scott Wallace, and others during the 1970s.

SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). It is particularly useful in handling structured data, i.e. data incorporating relations among entities and variables.

<span class="mw-page-title-main">Universally unique identifier</span> Label used for information in computer systems

A universally unique identifier (UUID) is a 128-bit label used for information in computer systems. The term globally unique identifier (GUID) is also used.

ABAP is a high-level programming language created by the German software company SAP SE. It is currently positioned, alongside Java, as the language for programming the SAP NetWeaver Application Server, which is part of the SAP NetWeaver platform for building business applications.

The Lempel–Ziv–Markov chain algorithm (LZMA) is an algorithm used to perform lossless data compression. It has been under development since either 1996 or 1998 by Igor Pavlov and was first used in the 7z format of the 7-Zip archiver. This algorithm uses a dictionary compression scheme somewhat similar to the LZ77 algorithm published by Abraham Lempel and Jacob Ziv in 1977 and features a high compression ratio and a variable compression-dictionary size, while still maintaining decompression speed similar to other commonly used compression algorithms.

Modbus is a data communications protocol originally published by Modicon in 1979 for use with its programmable logic controllers (PLCs). Modbus has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices.

The SQL SELECT statement returns a result set of records, from one or more tables.

This article compares two programming languages: C# with Java. While the focus of this article is mainly the languages and their features, such a comparison will necessarily also consider some features of platforms and libraries. For a more detailed comparison of the platforms, see Comparison of the Java and .NET platforms.

Apple events are the message-based interprocess communication mechanism in Mac OS, first making an appearance in System 7 and supported by every version of the classic Mac OS since then and by macOS. Apple events describe "high-level" events such as "open document" or "print file", whereas earlier OSs had supported much more basic events, namely "click" and "keypress". Apple events form the basis of the Mac OS scripting system, the Open Scripting Architecture.

In computer science, the Boolean is a data type that has one of two possible values which is intended to represent the two truth values of logic and Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century. The Boolean data type is primarily associated with conditional statements, which allow different actions by changing control flow depending on whether a programmer-specified Boolean condition evaluates to true or false. It is a special case of a more general logical data type—logic does not always need to be Boolean.

<span class="mw-page-title-main">Null (SQL)</span> Marker used in SQL databases to indicate a value does not exist

In SQL, null or NULL is a special marker used to indicate that a data value does not exist in the database. Introduced by the creator of the relational database model, E. F. Codd, SQL null serves to fulfil the requirement that all true relational database management systems (RDBMS) support a representation of "missing information and inapplicable information". Codd also introduced the use of the lowercase Greek omega (ω) symbol to represent null in database theory. In SQL, NULL is a reserved word used to identify this marker.

In computer science, a database cursor is a mechanism that enables traversal over the records in a database. Cursors facilitate subsequent processing in conjunction with the traversal, such as retrieval, addition and removal of database records. The database cursor characteristic of traversal makes cursors akin to the programming language concept of iterator.

Entity Framework (EF) is an open source object–relational mapping (ORM) framework for ADO.NET. It was originally shipped as an integral part of .NET Framework. Starting with Entity Framework version 6, it has been delivered separately from the .NET Framework.

Action Message Format (AMF) is a binary format used to serialize object graphs such as ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives. The Actionscript 3 language provides classes for encoding and decoding from the AMF format.

Language Integrated Query is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, originally released as a major part of .NET Framework 3.5 in 2007.

Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network. Microsoft markets at least a dozen different editions of Microsoft SQL Server, aimed at different audiences and for workloads ranging from small single-machine applications to large Internet-facing applications with many concurrent users.

Escape sequences are used in the programming languages C and C++, and their design was copied in many other languages such as Java, PHP, C#, etc. An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly.

PL/SQL is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database, Times Ten in-memory database, and IBM Db2. Oracle Corporation usually extends PL/SQL functionality with each successive release of the Oracle Database.

<span class="mw-page-title-main">Distributed Data Management Architecture</span>

Distributed Data Management Architecture (DDM) is IBM's open, published software architecture for creating, managing and accessing data on a remote computer. DDM was initially designed to support record-oriented files; it was extended to support hierarchical directories, stream-oriented files, queues, and system command processing; it was further extended to be the base of IBM's Distributed Relational Database Architecture (DRDA); and finally, it was extended to support data description and conversion. Defined in the period from 1980 to 1993, DDM specifies necessary components, messages, and protocols, all based on the principles of object-orientation. DDM is not, in itself, a piece of software; the implementation of DDM takes the form of client and server products. As an open architecture, products can implement subsets of DDM architecture and products can extend DDM to meet additional requirements. Taken together, DDM products implement a distributed file system.

The syntax of the SQL programming language is defined and maintained by ISO/IEC SC 32 as part of ISO/IEC 9075. This standard is not freely available. Despite the existence of the standard, SQL code is not completely portable among different database systems without adjustments.

References

  1. "SQL:2008 draft" (Zip). Whitemarsh Information Systems Corporation.{{cite journal}}: Cite journal requires |journal= (help)