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).
GET DIAGNOSTICS
offers more details about the last executed SQL command.The following table lists the standard-conforming values - based on . 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.
SQLSTATE | Cat. | Class | Class Text | Subclass | Subclass Text | SQL part |
---|---|---|---|---|---|---|
S | 00 | successful completion | 000 | |||
W | 01 | warning | 000 | |||
W | 01 | warning | 001 | cursor operation conflict | ||
W | 01 | warning | 002 | disconnect error | ||
W | 01 | warning | 003 | null value eliminated in set function | ||
W | 01 | warning | 004 | string data, right truncation | ||
W | 01 | warning | 005 | insufficient item descriptor areas | ||
W | 01 | warning | 006 | privilege not revoked | ||
W | 01 | warning | 007 | privilege not granted | ||
W | 01 | warning | 009 | search condition too long for information schema | ||
W | 01 | warning | 00A | query expression too long for information schema | ||
W | 01 | warning | 00B | default value too long for information schema | ||
W | 01 | warning | 00C | result sets returned | ||
W | 01 | warning | 00D | additional result sets returned | ||
W | 01 | warning | 00E | attempt to return too many result sets | ||
W | 01 | warning | 00F | statement too long for information schema | ||
W | 01 | warning | 010 | column cannot be mapped | SQL/XML | |
W | 01 | warning | 011 | SQL-Java path too long for information schema | SQL/JRT | |
W | 01 | warning | 012 | invalid number of conditions | ||
W | 01 | warning | 02F | array data, right truncation | ||
N | 02 | no data | 000 | |||
N | 02 | no data | 001 | no additional result sets returned | ||
X | 07 | dynamic SQL error | 000 | |||
X | 07 | dynamic SQL error | 001 | using clause does not match dynamic parameter specifications | ||
X | 07 | dynamic SQL error | 002 | using clause does not match target specifications | ||
X | 07 | dynamic SQL error | 003 | cursor specification cannot be executed | ||
X | 07 | dynamic SQL error | 004 | using clause required for dynamic parameters | ||
X | 07 | dynamic SQL error | 005 | prepared statement not a cursor specification | ||
X | 07 | dynamic SQL error | 006 | restricted data type attribute violation | ||
X | 07 | dynamic SQL error | 007 | using clause required for result fields | ||
X | 07 | dynamic SQL error | 008 | invalid descriptor count | ||
X | 07 | dynamic SQL error | 009 | invalid descriptor index | ||
X | 07 | dynamic SQL error | 00B | data type transform function violation | ||
X | 07 | dynamic SQL error | 00C | undefined DATA value | ||
X | 07 | dynamic SQL error | 00D | invalid DATA target | ||
X | 07 | dynamic SQL error | 00E | invalid LEVEL value | ||
X | 07 | dynamic SQL error | 00F | invalid DATETIME_INTERVAL_CODE | ||
X | 08 | connection exception | 000 | |||
X | 08 | connection exception | 001 | SQL-client unable to establish SQL-connection | ||
X | 08 | connection exception | 002 | connection name in use | ||
X | 08 | connection exception | 003 | connection does not exist | ||
X | 08 | connection exception | 004 | SQL-server rejected establishment of SQL-connection | ||
X | 08 | connection exception | 006 | connection failure | ||
X | 08 | connection exception | 007 | transaction resolution unknown | ||
X | 09 | triggered action exception | 000 | |||
X | 0A | feature not supported | 000 | |||
X | 0A | feature not supported | 001 | multiple server transactions | ||
X | 0D | invalid target type specification | 000 | |||
X | 0E | invalid schema name list specification | 000 | |||
X | 0F | locator exception | 000 | |||
X | 0F | locator exception | 001 | invalid specification | ||
X | 0K | resignal when handler not active | 000 | SQL/PSM | ||
X | 0L | invalid grantor | 000 | |||
X | 0M | invalid SQL-invoked procedure reference | 000 | |||
X | 0N | SQL/XML mapping error | 000 | SQL/XML | ||
X | 0N | SQL/XML mapping error | 001 | unmappable XML name | SQL/XML | |
X | 0N | SQL/XML mapping error | 002 | invalid XML character | SQL/XML | |
X | 0P | invalid role specification | 000 | |||
X | 0S | invalid transform group name specification | 000 | |||
X | 0T | target table disagrees with cursor specification | 000 | |||
X | 0U | attempt to assign to non-updatable column | 000 | |||
X | 0V | attempt to assign to ordering column | 000 | |||
X | 0W | prohibited statement encountered during trigger execution | 000 | |||
X | 0W | prohibited statement encountered during trigger execution | 001 | modify table modified by data change delta table | ||
X | 0X | invalid foreign server specification | 000 | SQL/MED | ||
X | 0Y | pass-through specific condition | 000 | SQL/MED | ||
X | 0Y | pass-through specific condition | 001 | invalid cursor option | SQL/MED | |
X | 0Y | pass-through specific condition | 002 | invalid cursor allocation | SQL/MED | |
X | 0Z | diagnostics exception | 000 | |||
X | 0Z | diagnostics exception | 001 | maximum number of stacked diagnostics areas exceeded | ||
X | 0Z | diagnostics exception | 002 | stacked diagnostics accessed without active handler | SQL/PSM | |
X | 10 | XQuery error | 000 | SQL/XML | ||
X | 20 | case not found for case statement | 000 | SQL/PSM | ||
X | 21 | cardinality violation | 000 | |||
X | 22 | data exception | 000 | |||
X | 22 | data exception | 001 | string data, right truncation | ||
X | 22 | data exception | 002 | null value, no indicator parameter | ||
X | 22 | data exception | 003 | numeric value out of range | ||
X | 22 | data exception | 004 | null value not allowed | ||
X | 22 | data exception | 005 | error in assignment | ||
X | 22 | data exception | 006 | invalid interval format | ||
X | 22 | data exception | 007 | invalid datetime format | ||
X | 22 | data exception | 008 | datetime field overflow | ||
X | 22 | data exception | 009 | invalid time zone displacement value | ||
X | 22 | data exception | 00B | escape character conflict | ||
X | 22 | data exception | 00C | invalid use of escape character | ||
X | 22 | data exception | 00D | invalid escape octet | ||
X | 22 | data exception | 00E | null value in array target | ||
X | 22 | data exception | 00F | zero-length character string | ||
X | 22 | data exception | 00G | most specific type mismatch | ||
X | 22 | data exception | 00H | sequence generator limit exceeded | ||
X | 22 | data exception | 00J | nonidentical notations with the same name | SQL/XML | |
X | 22 | data exception | 00K | nonidentical unparsed entities with the same name | SQL/XML | |
X | 22 | data exception | 00L | not an XML document | SQL/XML | |
X | 22 | data exception | 00M | invalid XML document | SQL/XML | |
X | 22 | data exception | 00N | invalid XML content | SQL/XML | |
X | 22 | data exception | 00P | interval value out of range | ||
X | 22 | data exception | 00Q | multiset value overflow | ||
X | 22 | data exception | 00R | XML value overflow | SQL/XML | |
X | 22 | data exception | 00S | invalid comment | SQL/XML | |
X | 22 | data exception | 00T | invalid processing instruction | SQL/XML | |
X | 22 | data exception | 00U | not an XQuery document node | SQL/XML | |
X | 22 | data exception | 00V | invalid XQuery context item | SQL/XML | |
X | 22 | data exception | 00W | XQuery serialization error | SQL/XML | |
X | 22 | data exception | 010 | invalid indicator parameter value | ||
X | 22 | data exception | 011 | substring error | ||
X | 22 | data exception | 012 | division by zero | ||
X | 22 | data exception | 013 | invalid preceding or following size in window function | ||
X | 22 | data exception | 014 | invalid argument for NTILE function | ||
X | 22 | data exception | 015 | interval field overflow | ||
X | 22 | data exception | 016 | invalid argument for NTH_VALUE function | ||
X | 22 | data exception | 017 | invalid data specified for datalink | SQL/MED | |
X | 22 | data exception | 018 | invalid character value for cast | ||
X | 22 | data exception | 019 | invalid escape character | ||
X | 22 | data exception | 01A | null argument passed to datalink constructor | SQL/MED | |
X | 22 | data exception | 01B | invalid regular expression | ||
X | 22 | data exception | 01C | null row not permitted in table | ||
X | 22 | data exception | 01D | datalink value exceeds maximum length | SQL/MED | |
X | 22 | data exception | 01E | invalid argument for natural logarithm | ||
X | 22 | data exception | 01F | invalid argument for power function | ||
X | 22 | data exception | 01G | invalid argument for width bucket function | ||
X | 22 | data exception | 01H | invalid row version | ||
X | 22 | data exception | 01J | XQuery sequence cannot be validated | SQL/XML | |
X | 22 | data exception | 01K | XQuery document node cannot be validated | SQL/XML | |
X | 22 | data exception | 01L | no XML schema found | SQL/XML | |
X | 22 | data exception | 01M | element namespace not declared | SQL/XML | |
X | 22 | data exception | 01N | global element not declared | SQL/XML | |
X | 22 | data exception | 01P | no XML element with the specified QName | SQL/XML | |
X | 22 | data exception | 01Q | no XML element with the specified namespace | SQL/XML | |
X | 22 | data exception | 01R | validation failure | SQL/XML | |
X | 22 | data exception | 01S | invalid Query regular expression | ||
X | 22 | data exception | 01T | invalid Query option flag | ||
X | 22 | data exception | 01U | attempt to replace a zero-length string | ||
X | 22 | data exception | 01V | invalid Query replacement string | ||
X | 22 | data exception | 01W | invalid row count in fetch first clause | ||
X | 22 | data exception | 01X | invalid row count in result offset clause | ||
X | 22 | data exception | 021 | character not in repertoire | ||
X | 22 | data exception | 022 | indicator overflow | ||
X | 22 | data exception | 023 | invalid parameter value | ||
X | 22 | data exception | 024 | unterminated C string | ||
X | 22 | data exception | 025 | invalid escape sequence | ||
X | 22 | data exception | 026 | string data, length mismatch | ||
X | 22 | data exception | 027 | trim error | ||
X | 22 | data exception | 029 | noncharacter in UCS string | ||
X | 22 | data exception | 02A | null value in field reference | SQL/PSM | |
X | 22 | data exception | 02D | null value substituted for mutator subject parameter | ||
X | 22 | data exception | 02E | array element error | ||
X | 22 | data exception | 02F | array data, right truncation | ||
X | 22 | data exception | 02G | invalid repeat argument in a sample clause | ||
X | 22 | data exception | 02H | invalid sample size | ||
X | 23 | integrity constraint violation | 000 | |||
X | 23 | integrity constraint violation | 001 | restrict violation | ||
X | 24 | invalid cursor state | 000 | |||
X | 25 | invalid transaction state | 000 | |||
X | 25 | invalid transaction state | 001 | active SQL-transaction | ||
X | 25 | invalid transaction state | 002 | branch transaction already active | ||
X | 25 | invalid transaction state | 003 | inappropriate access mode for branch transaction | ||
X | 25 | invalid transaction state | 004 | inappropriate isolation level for branch transaction | ||
X | 25 | invalid transaction state | 005 | no active SQL-transaction for branch transaction | ||
X | 25 | invalid transaction state | 006 | read-only SQL-transaction | ||
X | 25 | invalid transaction state | 007 | schema and data statement mixing not supported | ||
X | 25 | invalid transaction state | 008 | held cursor requires same isolation level | ||
X | 26 | invalid SQL statement name | 000 | |||
X | 27 | triggered data change violation | 000 | |||
X | 27 | triggered data change violation | 001 | modify table modified by data change delta table | ||
X | 28 | invalid authorization specification | 000 | |||
X | 2B | dependent privilege descriptors still exist | 000 | |||
X | 2C | invalid character set name | 000 | |||
X | 2D | invalid transaction termination | 000 | |||
X | 2E | invalid connection name | 000 | |||
X | 2F | SQL routine exception | 000 | |||
X | 2F | SQL routine exception | 002 | modifying SQL-data not permitted | ||
X | 2F | SQL routine exception | 003 | prohibited SQL-statement attempted | ||
X | 2F | SQL routine exception | 004 | reading SQL-data not permitted | ||
X | 2F | SQL routine exception | 005 | function executed no return statement | ||
X | 2H | invalid collation name | 000 | |||
X | 30 | invalid SQL statement identifier | 000 | |||
X | 33 | invalid SQL descriptor name | 000 | |||
X | 34 | invalid cursor name | 000 | |||
X | 35 | invalid condition number | 000 | |||
X | 36 | cursor sensitivity exception | 000 | |||
X | 36 | cursor sensitivity exception | 001 | request rejected | ||
X | 36 | cursor sensitivity exception | 002 | request failed | ||
X | 38 | external routine exception | 000 | |||
X | 38 | external routine exception | 001 | containing SQL not permitted | ||
X | 38 | external routine exception | 002 | modifying SQL-data not permitted | ||
X | 38 | external routine exception | 003 | prohibited SQL-statement attempted | ||
X | 38 | external routine exception | 004 | reading SQL-data not permitted | ||
X | 39 | external routine invocation exception | 000 | |||
X | 39 | external routine invocation exception | 004 | null value not allowed | ||
X | 3B | savepoint exception | 000 | |||
X | 3B | savepoint exception | 001 | invalid specification | ||
X | 3B | savepoint exception | 002 | too many | ||
X | 3C | ambiguous cursor name | 000 | |||
X | 3D | invalid catalog name | 000 | |||
X | 3F | invalid schema name | 000 | |||
X | 40 | transaction rollback | 000 | |||
X | 40 | transaction rollback | 001 | serialization failure | ||
X | 40 | transaction rollback | 002 | integrity constraint violation | ||
X | 40 | transaction rollback | 003 | statement completion unknown | ||
X | 40 | transaction rollback | 004 | triggered action exception | ||
X | 42 | syntax error or access rule violation | 000 | |||
X | 44 | with check option violation | 000 | |||
X | 45 | unhandled user-defined exception | 000 | SQL/PSM | ||
X | 46 | OLB-specific error | 000 | SQL/OLB | ||
X | 46 | Java DDL | 001 | invalid URL | SQL/JRT | |
X | 46 | Java DDL | 002 | invalid JAR name | SQL/JRT | |
X | 46 | Java DDL | 003 | invalid class deletion | SQL/JRT | |
X | 46 | Java DDL | 005 | invalid replacement | SQL/JRT | |
X | 46 | Java DDL | 00A | attempt to replace uninstalled JAR | SQL/JRT | |
X | 46 | Java DDL | 00B | attempt to remove uninstalled JAR | SQL/JRT | |
X | 46 | Java DDL | 00C | invalid JAR removal | SQL/JRT | |
X | 46 | Java DDL | 00D | invalid path | SQL/JRT | |
X | 46 | Java DDL | 00E | self-referencing path | SQL/JRT | |
X | 46 | Java DDL | 102 | invalid JAR name in path | SQL/JRT | |
X | 46 | Java DDL | 103 | unresolved class name | SQL/JRT | |
X | 46 | OLB-specific error | 110 | unsupported feature | SQL/OLB | |
X | 46 | OLB-specific error | 120 | invalid class declaration | SQL/OLB | |
X | 46 | OLB-specific error | 121 | invalid column name | SQL/OLB | |
X | 46 | OLB-specific error | 122 | invalid number of columns | SQL/OLB | |
X | 46 | OLB-specific error | 130 | invalid profile state | SQL/OLB | |
X | HW | datalink exception | 000 | SQL/MED | ||
X | HW | datalink exception | 001 | external file not linked | SQL/MED | |
X | HW | datalink exception | 002 | external file already linked | SQL/MED | |
X | HW | datalink exception | 003 | referenced file does not exist | SQL/MED | |
X | HW | datalink exception | 004 | invalid write token | SQL/MED | |
X | HW | datalink exception | 005 | invalid datalink construction | SQL/MED | |
X | HW | datalink exception | 006 | invalid write permission for update | SQL/MED | |
X | HW | datalink exception | 007 | referenced file not valid | SQL/MED | |
X | HV | FDW-specific condition | 000 | SQL/MED | ||
X | HV | FDW-specific condition | 001 | memory allocation error | SQL/MED | |
X | HV | FDW-specific condition | 002 | dynamic parameter value needed | SQL/MED | |
X | HV | FDW-specific condition | 004 | invalid data type | SQL/MED | |
X | HV | FDW-specific condition | 005 | column name not found | SQL/MED | |
X | HV | FDW-specific condition | 006 | invalid data type descriptors | SQL/MED | |
X | HV | FDW-specific condition | 007 | invalid column name | SQL/MED | |
X | HV | FDW-specific condition | 008 | invalid column number | SQL/MED | |
X | HV | FDW-specific condition | 009 | invalid use of null pointer | SQL/MED | |
X | HV | FDW-specific condition | 00A | invalid string format | SQL/MED | |
X | HV | FDW-specific condition | 00B | invalid handle | SQL/MED | |
X | HV | FDW-specific condition | 00C | invalid option index | SQL/MED | |
X | HV | FDW-specific condition | 00D | invalid option name | SQL/MED | |
X | HV | FDW-specific condition | 00J | option name not found | SQL/MED | |
X | HV | FDW-specific condition | 00K | reply handle | SQL/MED | |
X | HV | FDW-specific condition | 00L | unable to create execution | SQL/MED | |
X | HV | FDW-specific condition | 00M | unable to create reply | SQL/MED | |
X | HV | FDW-specific condition | 00N | unable to establish connection | SQL/MED | |
X | HV | FDW-specific condition | 00P | no schemas | SQL/MED | |
X | HV | FDW-specific condition | 00Q | schema not found | SQL/MED | |
X | HV | FDW-specific condition | 00R | table not found | SQL/MED | |
X | HV | FDW-specific condition | 010 | function sequence error | SQL/MED | |
X | HV | FDW-specific condition | 014 | limit on number of handles exceeded | SQL/MED | |
X | HV | FDW-specific condition | 021 | inconsistent descriptor information | SQL/MED | |
X | HV | FDW-specific condition | 024 | invalid attribute value | SQL/MED | |
X | HV | FDW-specific condition | 090 | invalid string length or buffer length | SQL/MED | |
X | HV | FDW-specific condition | 091 | invalid descriptor field identifier | SQL/MED | |
="height:0.5em; background: #eaecf0;" colspan="7" | ||||||
X | HY | CLI-specific condition | 000 | SQL/CLI | ||
HY??? | X | HY | CLI-specific condition | dynamic parameter value needed | SQL/CLI | |
HY??? | X | HY | CLI-specific condition | invalid handle | SQL/CLI | |
X | HY | CLI-specific condition | 001 | memory allocation error | SQL/CLI | |
X | HY | CLI-specific condition | 003 | invalid data type in application descriptor | SQL/CLI | |
X | HY | CLI-specific condition | 004 | invalid data type | SQL/CLI | |
X | HY | CLI-specific condition | 007 | associated statement is not prepared | SQL/CLI | |
X | HY | CLI-specific condition | 008 | operation canceled | SQL/CLI | |
X | HY | CLI-specific condition | 009 | invalid use of null pointer | SQL/CLI | |
X | HY | CLI-specific condition | 010 | function sequence error | SQL/CLI | |
X | HY | CLI-specific condition | 011 | attribute cannot be set now | SQL/CLI | |
X | HY | CLI-specific condition | 012 | invalid transaction operation code | SQL/CLI | |
X | HY | CLI-specific condition | 013 | memory management error | SQL/CLI | |
X | HY | CLI-specific condition | 014 | limit on number of handles exceeded | SQL/CLI | |
X | HY | CLI-specific condition | 017 | invalid use of automatically allocated descriptor handle | SQL/CLI | |
X | HY | CLI-specific condition | 018 | server declined the cancellation request | SQL/CLI | |
X | HY | CLI-specific condition | 019 | non-string data cannot be sent in pieces | SQL/CLI | |
X | HY | CLI-specific condition | 020 | attempt to concatenate a null value | SQL/CLI | |
X | HY | CLI-specific condition | 021 | inconsistent descriptor information | SQL/CLI | |
X | HY | CLI-specific condition | 024 | invalid attribute value | SQL/CLI | |
X | HY | CLI-specific condition | 055 | non-string data cannot be used with string routine | SQL/CLI | |
X | HY | CLI-specific condition | 090 | invalid string length or buffer length | SQL/CLI | |
X | HY | CLI-specific condition | 091 | invalid descriptor field identifier | SQL/CLI | |
X | HY | CLI-specific condition | 092 | invalid attribute identifier | SQL/CLI | |
X | HY | CLI-specific condition | 093 | invalid datalink value | SQL/MED | |
X | HY | CLI-specific condition | 095 | invalid FunctionId specified | SQL/CLI | |
X | HY | CLI-specific condition | 096 | invalid information type | SQL/CLI | |
X | HY | CLI-specific condition | 097 | column type out of range | SQL/CLI | |
X | HY | CLI-specific condition | 098 | scope out of range | SQL/CLI | |
X | HY | CLI-specific condition | 099 | nullable type out of range | SQL/CLI | |
X | HY | CLI-specific condition | 103 | invalid retrieval code | SQL/CLI | |
X | HY | CLI-specific condition | 104 | invalid LengthPrecision value | SQL/CLI | |
X | HY | CLI-specific condition | 105 | invalid parameter mode | SQL/CLI | |
X | HY | CLI-specific condition | 106 | invalid fetch orientation | SQL/CLI | |
X | HY | CLI-specific condition | 107 | row value out of range | SQL/CLI | |
X | HY | CLI-specific condition | 108 | invalid cursor position | SQL/CLI | |
X | HY | CLI-specific condition | C00 | optional feature not implemented | SQL/CLI | |
HZ | Reserved for ISO9579 (RDA) | |||||
This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "SQLSTATE".
Except where otherwise indicated, Everything.Explained.Today is © Copyright 2009-2024, A B Cryer, All Rights Reserved. Cookie policy.