Description of SQL Error Codes
Based on X/Open and SQL Access Group SQL CAE Specifications (1992), SQLERROR returns an SQLSTATE value. An SQLSTATE value is a string composed of five characters, the first two representing an SQL error class and the last three representing a subclass. The code of an error or warning can contain digits and uppercase letters. 00000 indicates success. Most SQLSTATE codes are defined in SQL standards.
GaussDB(DWS) also uses the SQLSTATE values of the SQL standard. For details, see Table 1.
SQLSTATE Value |
Error Code |
---|---|
Class 00 - Success |
|
00000 |
SUCCESSFUL_COMPLETION |
Class 01 - Warning |
|
01000 |
WARNING |
0100C |
DYNAMIC_RESULT_SETS_RETURNED |
01008 |
IMPLICIT_ZERO_BIT_PADDING |
01003 |
NULL_VALUE_ELIMINATED_IN_SET_FUNCTION |
01007 |
PRIVILEGE_NOT_GRANTED |
01006 |
PRIVILEGE_NOT_REVOKED |
01004 |
STRING_DATA_RIGHT_TRUNCATION |
01P01 |
DEPRECATED_FEATURE |
Class 02 - No data (According to SQL standards, it also belongs to the warning class.) |
|
02000 |
NO_DATA |
02001 |
NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED |
Class 03 - Incomplete SQL statement |
|
03000 |
SQL_STATEMENT_NOT_YET_COMPLETE |
Class 08 - Connection exception |
|
08000 |
CONNECTION_EXCEPTION |
08003 |
CONNECTION_DOES_NOT_EXIST |
08006 |
CONNECTION_FAILURE |
08001 |
SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION |
08004 |
SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION |
08007 |
TRANSACTION_RESOLUTION_UNKNOWN |
08P01 |
PROTOCOL_VIOLATION |
Class 09 - Abnormal triggering action |
|
09000 |
TRIGGERED_ACTION_EXCEPTION |
Class 0A - Unsupported features |
|
0A000 |
FEATURE_NOT_SUPPORTED |
0A100 |
STREAM_NOT_SUPPORTED |
Class 0B - Invalid transaction initialization |
|
0B000 |
INVALID_TRANSACTION_INITIATION |
Class 0F - Locator exception |
|
0F000 |
LOCATOR_EXCEPTION |
0F001 |
INVALID_LOCATOR_SPECIFICATION |
Class 0L - Invalid grantor |
|
0L000 |
INVALID_GRANTOR |
0LP01 |
INVALID_GRANT_OPERATION |
Class 0P - Invalid role declaration |
|
0P000 |
INVALID_ROLE_SPECIFICATION |
Class 0Z - Diagnosis exception |
|
0Z000 |
DIAGNOSTICS_EXCEPTION |
0Z002 |
STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER |
Class 20 - Not found case |
|
20000 |
CASE_NOT_FOUND |
Class 21 - Cardinality violation |
|
21000 |
CARDINALITY_VIOLATION |
Class 22 - Data exception |
|
22000 |
DATA_EXCEPTION |
2202E |
ARRAY_SUBSCRIPT_ERROR |
22021 |
CHARACTER_NOT_IN_REPERTOIRE |
22008 |
DATETIME_FIELD_OVERFLOW |
22012 |
DIVISION_BY_ZERO |
22005 |
ERROR_IN_ASSIGNMENT |
2200B |
ESCAPE_CHARACTER_CONFLICT |
22022 |
INDICATOR_OVERFLOW |
22015 |
INTERVAL_FIELD_OVERFLOW |
2201E |
INVALID_ARGUMENT_FOR_LOGARITHM |
22014 |
INVALID_ARGUMENT_FOR_NTILE_FUNCTION |
22016 |
INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION |
2201F |
INVALID_ARGUMENT_FOR_POWER_FUNCTION |
2201G |
INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION |
22018 |
INVALID_CHARACTER_VALUE_FOR_CAST |
22007 |
INVALID_DATETIME_FORMAT |
22019 |
INVALID_ESCAPE_CHARACTER |
2200D |
INVALID_ESCAPE_OCTET |
22025 |
INVALID_ESCAPE_SEQUENCE |
22P06 |
NONSTANDARD_USE_OF_ESCAPE_CHARACTER |
22010 |
INVALID_INDICATOR_PARAMETER_VALUE |
22023 |
INVALID_PARAMETER_VALUE |
2201B |
INVALID_REGULAR_EXPRESSION |
2201W |
INVALID_ROW_COUNT_IN_LIMIT_CLAUSE |
2201X |
INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE |
2202H |
Invalid sampling (ERRCODE_INVALID_TABLESAMPLE_ARGUMENT) |
2202G |
Invalid repeated sampling (ERRCODE_INVALID_TABLESAMPLE_REPEAT) |
22009 |
INVALID_TIME_ZONE_DISPLACEMENT_VALUE |
2200C |
INVALID_USE_OF_ESCAPE_CHARACTER |
2200G |
MOST_SPECIFIC_TYPE_MISMATCH |
22004 |
NULL_VALUE_NOT_ALLOWED |
22002 |
NULL_VALUE_NO_INDICATOR_PARAMETER |
22003 |
NUMERIC_VALUE_OUT_OF_RANGE |
22005 |
Number of concurrent tasks exceeds the limit (ERRCODE_DOP_VALUE_OUT_OF_RANGE) |
22026 |
STRING_DATA_LENGTH_MISMATCH |
22028 |
Regular expression mismatching (ERRCODE_REGEXP_MISMATCH) |
22001 |
STRING_DATA_RIGHT_TRUNCATION |
22011 |
SUBSTRING_ERROR |
22027 |
TRIM_ERROR |
22024 |
UNTERMINATED_C_STRING |
2200F |
ZERO_LENGTH_CHARACTER_STRING |
22P01 |
FLOATING_POINT_EXCEPTION |
22P02 |
INVALID_TEXT_REPRESENTATION |
22P03 |
INVALID_BINARY_REPRESENTATION |
22P04 |
BAD_COPY_FILE_FORMAT |
22P05 |
UNTRANSLATABLE_CHARACTER |
22P06 |
Failed to find the memory (ERRCODE_CACHE_LOOKUP_FAILED) |
22P07 |
Failed to read the file (ERRCODE_FILE_READ_FAILED) |
22P08 |
Failed to obtain data (ERRCODE_FETCH_DATA_FAILED) |
2200L |
NOT_AN_XML_DOCUMENT |
2200M |
INVALID_XML_DOCUMENT |
2200N |
INVALID_XML_CONTENT |
2200O |
Invalid XML error information (ERRCODE_INVALID_XML_ERROR_CONTEXT) |
2200S |
INVALID_XML_COMMENT |
2200T |
INVALID_XML_PROCESSING_INSTRUCTION |
2200X |
Failed to close the RELATION (RELATION_CLOSE_ERROR) |
Class 23 - Integrity constraint violation |
|
23000 |
INTEGRITY_CONSTRAINT_VIOLATION |
23001 |
RESTRICT_VIOLATION |
23502 |
NOT_NULL_VIOLATION |
23503 |
FOREIGN_KEY_VIOLATION |
23505 |
UNIQUE_VIOLATION |
23514 |
CHECK_VIOLATION |
23P01 |
EXCLUSION_VIOLATION |
Class 24 - Invalid cursor state |
|
24000 |
INVALID_CURSOR_STATE |
Class 25 - Invalid transaction state |
|
25000 |
INVALID_TRANSACTION_STATE |
25001 |
ACTIVE_SQL_TRANSACTION |
25002 |
BRANCH_TRANSACTION_ALREADY_ACTIVE |
25008 |
HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL |
25003 |
INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION |
25004 |
INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION |
25005 |
NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION |
25006 |
READ_ONLY_SQL_TRANSACTION |
25007 |
SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED |
25009 |
Failed to enable transactions during restoration (ERRCODE_RUN_TRANSACTION_DURING_RECOVERY) |
25010 |
Nonexistent transaction ID (ERRCODE_GXID_DOES_NOT_EXIST) |
25P01 |
NO_ACTIVE_SQL_TRANSACTION |
25P02 |
IN_FAILED_SQL_TRANSACTION |
Class 26 - Invalid SQL statement name |
|
26000 |
INVALID_SQL_STATEMENT_NAME |
Class 27 - Triggered data change violation |
|
27000 |
TRIGGERED_DATA_CHANGE_VIOLATION |
27001 |
Invalid triggered element (ERRCODE_TRIGGERED_INVALID_TUPLE) |
Class 28 - Invalid authorization declaration |
|
28000 |
INVALID_AUTHORIZATION_SPECIFICATION |
28P01 |
INVALID_PASSWORD |
28P02 |
INITIAL_PASSWORD_NOT_MODIFIED |
Class 2B - Persistence of a dependent priority descriptor |
|
2B000 |
DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST |
2BP01 |
DEPENDENT_OBJECTS_STILL_EXIST |
Class 2D - Invalid transaction termination |
|
2D000 |
INVALID_TRANSACTION_TERMINATION |
Class 2F - SQL procedure exception |
|
2F000 |
SQL_ROUTINE_EXCEPTION |
2F005 |
FUNCTION_EXECUTED_NO_RETURN_STATEMENT |
2F002 |
MODIFYING_SQL_DATA_NOT_PERMITTED |
2F003 |
PROHIBITED_SQL_STATEMENT_ATTEMPTED |
2F004 |
READING_SQL_DATA_NOT_PERMITTED |
Class 34 - Invalid cursor name |
|
34000 |
INVALID_CURSOR_NAME |
Class 38 - External procedure exception |
|
38000 |
EXTERNAL_ROUTINE_EXCEPTION |
38001 |
CONTAINING_SQL_NOT_PERMITTED |
38002 |
MODIFYING_SQL_DATA_NOT_PERMITTED |
38003 |
PROHIBITED_SQL_STATEMENT_ATTEMPTED |
38004 |
READING_SQL_DATA_NOT_PERMITTED |
Class 39 - External procedure invocation exception |
|
39000 |
EXTERNAL_ROUTINE_INVOCATION_EXCEPTION |
39001 |
INVALID_SQLSTATE_RETURNED |
39004 |
NULL_VALUE_NOT_ALLOWED |
39P01 |
TRIGGER_PROTOCOL_VIOLATED |
39P02 |
SRF_PROTOCOL_VIOLATED |
Class 3B - Save point exception |
|
3B000 |
SAVEPOINT_EXCEPTION |
3B001 |
INVALID_SAVEPOINT_SPECIFICATION |
Class 3D - Invalid database name |
|
3D000 |
INVALID_CATALOG_NAME |
Class 3F - Invalid schema name |
|
3F000 |
INVALID_SCHEMA_NAME |
Class 40 - Transaction rollback |
|
40000 |
TRANSACTION_ROLLBACK |
40002 |
TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION |
40001 |
SERIALIZATION_FAILURE |
40003 |
STATEMENT_COMPLETION_UNKNOWN |
40P01 |
DEADLOCK_DETECTED |
Class 42 - Syntax error or access rule violation |
|
42000 |
SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION |
42601 |
SYNTAX_ERROR |
42501 |
INSUFFICIENT_PRIVILEGE |
42846 |
CANNOT_COERCE |
42803 |
GROUPING_ERROR |
42P20 |
WINDOWING_ERROR |
42P19 |
INVALID_RECURSION |
42830 |
INVALID_FOREIGN_KEY |
42602 |
INVALID_NAME |
42622 |
NAME_TOO_LONG |
42939 |
RESERVED_NAME |
42804 |
DATATYPE_MISMATCH |
42P18 |
INDETERMINATE_DATATYPE |
42P21 |
COLLATION_MISMATCH |
42P22 |
INDETERMINATE_COLLATION |
42P23 |
Partitioning error (ERRCODE_PARTITION_ERROR) |
42P24 |
Invalid attribute value (ERRCODE_INVALID_ATTRIBUTE) |
42P25 |
Invalid aggregate function (ERRCODE_INVALID_AGG) |
42P26 |
Resource pool error (ERRCODE_RESOURCE_POOL_ERROR) |
42P27 |
Failed to find the parent plan (ERRCODE_PLAN_PARENT_NOT_FOUND) |
42P28 |
Update conflict (ERRCODE_MODIFY_CONFLICTS) |
42809 |
WRONG_OBJECT_TYPE |
42703 |
UNDEFINED_COLUMN |
42883 |
UNDEFINED_FUNCTION |
42P01 |
UNDEFINED_TABLE |
42P02 |
UNDEFINED_PARAMETER |
42704 |
UNDEFINED_OBJECT |
42701 |
DUPLICATE_COLUMN |
42P03 |
DUPLICATE_CURSOR |
42P04 |
DUPLICATE_DATABASE |
42723 |
DUPLICATE_FUNCTION |
42P05 |
DUPLICATE_PREPARED_STATEMENT |
42P06 |
DUPLICATE_SCHEMA |
42P07 |
DUPLICATE_TABLE |
42712 |
DUPLICATE_ALIAS |
42710 |
DUPLICATE_OBJECT |
42702 |
AMBIGUOUS_COLUMN |
42725 |
AMBIGUOUS_FUNCTION |
42P08 |
AMBIGUOUS_PARAMETER |
42P09 |
AMBIGUOUS_ALIAS |
42P10 |
INVALID_COLUMN_REFERENCE |
42611 |
INVALID_COLUMN_DEFINITION |
42P11 |
INVALID_CURSOR_DEFINITION |
42P12 |
INVALID_DATABASE_DEFINITION |
42P13 |
INVALID_FUNCTION_DEFINITION |
42P14 |
INVALID_PREPARED_STATEMENT_DEFINITION |
42P15 |
INVALID_SCHEMA_DEFINITION |
42P16 |
INVALID_TABLE_DEFINITION |
42P17 |
INVALID_OBJECT_DEFINITION |
Class 44 - WITH CHECK option violation |
|
44000 |
WITH_CHECK_OPTION_VIOLATION |
Class 53 - Insufficient resources |
|
53000 |
INSUFFICIENT_RESOURCES |
53100 |
DISK_FULL |
53200 |
OUT_OF_MEMORY |
53300 |
TOO_MANY_CONNECTIONS |
53400 |
CONFIGURATION_LIMIT_EXCEEDED |
Class 54 - Exceeded program limit |
|
54000 |
PROGRAM_LIMIT_EXCEEDED |
54001 |
STATEMENT_TOO_COMPLEX |
54011 |
TOO_MANY_COLUMNS |
54023 |
TOO_MANY_ARGUMENTS |
Class 55 - Object not in the predefined state |
|
55000 |
OBJECT_NOT_IN_PREREQUISITE_STATE |
55006 |
OBJECT_IN_USE |
55P02 |
CANT_CHANGE_RUNTIME_PARAM |
55P03 |
LOCK_NOT_AVAILABLE |
Class 57 - Operator intervention |
|
57000 |
OPERATOR_INTERVENTION |
57014 |
QUERY_CANCELED |
57015 |
QUERY_INTERNAL_CANCEL |
57P01 |
ADMIN_SHUTDOWN |
57P02 |
CRASH_SHUTDOWN |
57P03 |
CANNOT_CONNECT_NOW |
57P04 |
DATABASE_DROPPED |
Class 58 - System errors (GaussDB Internal errors) |
|
58000 |
SYSTEM_ERROR |
58030 |
IO_ERROR |
58P01 |
UNDEFINED_FILE |
58P02 |
DUPLICATE_FILE |
Class F0 - File errors |
|
F0000 |
CONFIG_FILE_ERROR |
F0001 |
LOCK_FILE_EXISTS |
F0011 |
ERRCODE_HASHJOIN_TEMP_FILE_ERROR |
Class HV - External data errors (SQL/MED) |
|
HV000 |
FDW_ERROR |
HV005 |
FDW_COLUMN_NAME_NOT_FOUND |
HV002 |
FDW_DYNAMIC_PARAMETER_VALUE_NEEDED |
HV010 |
FDW_FUNCTION_SEQUENCE_ERROR |
HV021 |
FDW_INCONSISTENT_DESCRIPTOR_INFORMATION |
HV024 |
FDW_INVALID_ATTRIBUTE_VALUE |
HV007 |
FDW_INVALID_COLUMN_NAME |
HV008 |
FDW_INVALID_COLUMN_NUMBER |
HV004 |
FDW_INVALID_DATA_TYPE |
HV006 |
FDW_INVALID_DATA_TYPE_DESCRIPTORS |
HV091 |
FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER |
HV00B |
FDW_INVALID_HANDLE |
HV00C |
FDW_INVALID_OPTION_INDEX |
HV00D |
FDW_INVALID_OPTION_NAME |
HV090 |
FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH |
HV00A |
FDW_INVALID_STRING_FORMAT |
HV009 |
FDW_INVALID_USE_OF_NULL_POINTER |
HV014 |
FDW_TOO_MANY_HANDLES |
HV001 |
FDW_OUT_OF_MEMORY |
HV00P |
FDW_NO_SCHEMAS |
HV00J |
FDW_OPTION_NAME_NOT_FOUND |
HV00K |
FDW_REPLY_HANDLE |
HV00Q |
FDW_SCHEMA_NOT_FOUND |
HV00R |
FDW_TABLE_NOT_FOUND |
HV00L |
FDW_UNABLE_TO_CREATE_EXECUTION |
HV00M |
FDW_UNABLE_TO_CREATE_REPLY |
HV00N |
FDW_UNABLE_TO_ESTABLISH_CONNECTION |
Class P0 - PL/pgSQL errors |
|
P0000 |
PLPGSQL_ERROR |
P0001 |
RAISE_EXCEPTION |
P0002 |
NO_DATA_FOUND |
P0003 |
TOO_MANY_ROWS |
P0004 |
FORALL_NEED_DML |
Class XX - Internal errors |
|
XX000 |
INTERNAL_ERROR |
XX001 |
DATA_CORRUPTED |
XX002 |
INDEX_CORRUPTED |
XX003 |
STREAM_REMOTE_CLOSE_SOCKET |
XX004 |
Unknown node type (ERRCODE_UNRECOGNIZED_NODE_TYPE) |
XX005 |
Abnormal null value (ERRCODE_UNEXPECTED_NULL_VALUE) |
XX006 |
Abnormal node status (ERRCODE_UNEXPECTED_NODE_STATE) |
XX007 |
Empty JUNK column (ERRCODE_NULL_JUNK_ATTRIBUTE) |
XX008 |
Inconsistent optimizer status (ERRCODE_OPTIMIZER_INCONSISTENT_STATE) |
XX009 |
Repeated query ID (ERRCODE_STREAM_DUPLICATE_QUERY_ID) |
XX010 |
Invalid buffer (INVALID_BUFFER) |
XX011 |
Invalid buffer reference (INVALID_BUFFER_REFERENCE) |
XX012 |
Node ID mismatching (ERRCODE_NODE_ID_MISSMATCH) |
XX013 |
Failed to modify xid base (CANNOT_MODIFY_XIDBASE) |
XX014 |
Damaged TOAST table (UNEXPECTED_CHUNK_VALUE) |
Class YY - SQL reset errors |
|
YY001 |
CONNECTION_RESET_BY_PEER |
YY002 |
STREAM_CONNECTION_RESET_BY_PEER |
YY003 |
LOCK_WAIT_TIMEOUT |
YY004 |
CONNECTION_TIMED_OUT |
YY005 |
SET_QUERY_ERROR |
YY006 |
OUT_OF_LOGICAL_MEMORY |
YY007 |
SCTP_MEMORY_ALLOC |
YY008 |
SCTP_NO_DATA_IN_BUFFER |
YY009 |
SCTP_RELEASE_MEMORY_CLOSE |
YY010 |
SCTP_TCP_DISCONNECT |
YY011 |
SCTP_DISCONNECT |
YY012 |
SCTP_REMOTE_CLOSE |
YY013 |
SCTP_WAIT_POLL_UNKNOW |
YY014 |
Invalid snapshot (SNAPSHOT_INVALID) |
YY015 |
Communication information receiving error (ERRCODE_CONNECTION_RECEIVE_WRONG) |
Class SI – SPI interface errors |
|
SP000 |
SPI interface error (ERRCODE_SPI_ERROR) |
SP001 |
SPI communication failure (ERRCODE_SPI_CONNECTION_FAILURE) |
SP002 |
SPI completion failure (ERRCODE_SPI_FINISH_FAILURE) |
SP003 |
SPI preparation failure (ERRCODE_SPI_PREPARE_FAILURE) |
SP004 |
Failed to enable the SPI cursor (ERRCODE_SPI_CURSOR_OPEN_FAILURE) |
SP005 |
SPI execution failure (ERRCODE_SPI_EXECUTE_FAILURE) |
SP006 |
Improper SPI invoking (ERRORCODE_SPI_IMPROPER_CALL) |
Class RB - RBTree errors |
|
RB001 |
Invalid RBTree node status (RBTREE_INVALID_NODE_STATE) |
RB002 |
Invalid RBTree iteration order (RBTREE_INVALID_ITERATOR_ORDER) |
Class PD - PL debugger errors |
|
D0000 |
PLDEBUGGER_INTERNAL_ERROR |
D0001 |
DUPLICATE_BREAKPOINT |
D0002 |
FUNCTION_HASH_IS_NOT_INITIALIZED |
D0003 |
BREAKPOINT_IS_NOT_PRESENT |
D0004 |
DEBUG_SERVER_ALREADY_IS_ATTACHED |
D0005 |
DEBUG_SERVER_NOT_ATTACHED |
D0006 |
DEBUG_SERVER_ALREADY_IN_SYNC |
D0007 |
DEBUG_TARGET_SERVERS_NOT_IN_SYNC |
D0008 |
TARGET_SERVER_ALREADY_IN_SYNC |
D0009 |
NON_EXISTANT_VARIABLE |
D0010 |
INVALID_TARGET_SESSION_ID |
D0011 |
INVALID_OPERATION |
D0012 |
MAXIMUM_NUMBER_OF_DEBUG_SESSIONS_REACHED |
D0013 |
MAXIMUM_NUMBER_OF_BREAKPOINTS_REACHED |
Class LL – Logical decoding errors |
|
LL001 |
Logical decoding error (LOGICAL_DECODE_ERROR) |
LL002 |
Hash table query error (RELFILENODEMAP) |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.