Appendix BException Codes and Messages

This appendix includes:

Custom Exceptions

You can create custom exceptions for use in PSQL modules, with message text of up to 1,021 characters. For more information, see CREATE EXCEPTION in Chapter 5, Data Definition (DDL) Statements and, for usage, the statement EXCEPTION in Chapter 7, Procedural SQL (PSQL) Statements.

The Firebird SQLCODE error codes do not correlate with the standards-compliant SQLSTATE codes. SQLCODE has been used for many years and should be considered as deprecated now. Support for SQLCODE is likely to be dropped in a future version.

B.1SQLSTATE Error Codes and Descriptions

This table provides the error codes and message texts for the SQLSTATE context variables.

The structure of an SQLSTATE error code is five characters comprising the SQL error class (2 characters) and the SQL subclass (3 characters).

Note

Although Firebird tries to use SQLSTATE codes defined in ISO/IEC 9075 (the SQL standard), some are non-standard or derive from older standards like X/Open SQL for historic reasons.

Table B.1SQLSTATE Codes and Message Texts
SQLSTATEMapped Message

SQLCLASS 00 (Success)

00000

Success

SQLCLASS 01 (Warning)

01000

General warning

01001

Cursor operation conflict

01002

Disconnect error

01003

NULL value eliminated in set function

01004

String data, right-truncated

01005

Insufficient item descriptor areas

01006

Privilege not revoked

01007

Privilege not granted

01008

Implicit zero-bit padding

01100

Statement reset to unprepared

01101

Ongoing transaction has been committed

01102

Ongoing transaction has been rolled back

SQLCLASS 02 (No Data)

02000

No data found or no rows affected

SQLCLASS 07 (Dynamic SQL error)

07000

Dynamic SQL error

07001

Wrong number of input parameters

07002

Wrong number of output parameters

07003

Cursor specification cannot be executed

07004

USING clause required for dynamic parameters

07005

Prepared statement not a cursor-specification

07006

Restricted data type attribute violation

07007

USING clause required for result fields

07008

Invalid descriptor count

07009

Invalid descriptor index

SQLCLASS 08 (Connection Exception)

08001

Client unable to establish connection

08002

Connection name in use

08003

Connection does not exist

08004

Server rejected the connection

08006

Connection failure

08007

Transaction resolution unknown

SQLCLASS 0A (Feature Not Supported)

0A000

Feature Not Supported

SQLCLASS 0B (Invalid Transaction Initiation)

0B000

Invalid transaction initiation

SQLCLASS 0L (Invalid Grantor)

0L000

Invalid grantor

SQLCLASS 0P (Invalid Role Specification)

0P000

Invalid role specification

SQLCLASS 0U (Attempt to Assign to Non-Updatable Column)

0U000

Attempt to assign to non-updatable column

SQLCLASS 0V (Attempt to Assign to Ordering Column)

0V000

Attempt to assign to Ordering column

SQLCLASS 20 (Case Not Found For Case Statement)

20000

Case not found for case statement

SQLCLASS 21 (Cardinality Violation)

21000

Cardinality violation

21S01

Insert value list does not match column list

21S02

Degree of derived table does not match column list

SQLCLASS 22 (Data Exception)

22000

Data exception

22001

String data, right truncation

22002

Null value, no indicator parameter

22003

Numeric value out of range

22004

Null value not allowed

22005

Error in assignment

22006

Null value in field reference

22007

Invalid datetime format

22008

Datetime field overflow

22009

Invalid time zone displacement value

2200A

Null value in reference target

2200B

Escape character conflict

2200C

Invalid use of escape character

2200D

Invalid escape octet

2200E

Null value in array target

2200F

Zero-length character string

2200G

Most specific type mismatch

22010

Invalid indicator parameter value

22011

Substring error

22012

Division by zero

22014

Invalid update value

22015

Interval field overflow

22018

Invalid character value for cast

22019

Invalid escape character

2201B

Invalid regular expression

2201C

Null row not permitted in table

22012

Division by zero

22020

Invalid limit value

22021

Character not in repertoire

22022

Indicator overflow

22023

Invalid parameter value

22024

Character string not properly terminated

22025

Invalid escape sequence

22026

String data, length mismatch

22027

Trim error

22028

Row already exists

2202D

Null instance used in mutator function

2202E

Array element error

2202F

Array data, right truncation

SQLCLASS 23 (Integrity Constraint Violation)

23000

Integrity constraint violation

SQLCLASS 24 (Invalid Cursor State)

24000

Invalid cursor state

24504

The cursor identified in the UPDATE, DELETE, SET, or GET statement is not positioned on a row

SQLCLASS 25 (Invalid Transaction State)

25000

Invalid transaction state

25S01

Transaction state

25S02

Transaction is still active

25S03

Transaction is rolled back

SQLCLASS 26 (Invalid SQL Statement Name)

26000

Invalid SQL statement name

SQLCLASS 27 (Triggered Data Change Violation)

27000

Triggered data change violation

SQLCLASS 28 (Invalid Authorization Specification)

28000

Invalid authorization specification

SQLCLASS 2B (Dependent Privilege Descriptors Still Exist)

2B000

Dependent privilege descriptors still exist

SQLCLASS 2C (Invalid Character Set Name)

2C000

Invalid character set name

SQLCLASS 2D (Invalid Transaction Termination)

2D000

Invalid transaction termination

SQLCLASS 2E (Invalid Connection Name)

2E000

Invalid connection name

SQLCLASS 2F (SQL Routine Exception)

2F000

SQL routine exception

2F002

Modifying SQL-data not permitted

2F003

Prohibited SQL-statement attempted

2F004

Reading SQL-data not permitted

2F005

Function executed no return statement

SQLCLASS 33 (Invalid SQL Descriptor Name)

33000

Invalid SQL descriptor name

SQLCLASS 34 (Invalid Cursor Name)

34000

Invalid cursor name

SQLCLASS 35 (Invalid Condition Number)

35000

Invalid condition number

SQLCLASS 36 (Cursor Sensitivity Exception)

36001

Request rejected

36002

Request failed

SQLCLASS 37 (Invalid Identifier)

37000

Invalid identifier

37001

Identifier too long

SQLCLASS 38 (External Routine Exception)

38000

External routine exception

SQLCLASS 39 (External Routine Invocation Exception)

39000

External routine invocation exception

SQLCLASS 3B (Invalid Save Point)

3B000

Invalid save point

SQLCLASS 3C (Ambiguous Cursor Name)

3C000

Ambiguous cursor name

SQLCLASS 3D (Invalid Catalog Name)

3D000

Invalid catalog name

3D001

Catalog name not found

SQLCLASS 3F (Invalid Schema Name)

3F000

Invalid schema name

SQLCLASS 40 (Transaction Rollback)

40000

Ongoing transaction has been rolled back

40001

Serialization failure

40002

Transaction integrity constraint violation

40003

Statement completion unknown

SQLCLASS 42 (Syntax Error or Access Violation)

42000

Syntax error or access violation

42702

Ambiguous column reference

42725

Ambiguous function reference

42818

The operands of an operator or function are not compatible

42S01

Base table or view already exists

42S02

Base table or view not found

42S11

Index already exists

42S12

Index not found

42S21

Column already exists

42S22

Column not found

SQLCLASS 44 (With Check Option Violation)

44000

WITH CHECK OPTION Violation

SQLCLASS 45 (Unhandled User-defined Exception)

45000

Unhandled user-defined exception

SQLCLASS 54 (Program Limit Exceeded)

54000

Program limit exceeded

54001

Statement too complex

54011

Too many columns

54023

Too many arguments

SQLCLASS HY (CLI-specific Condition)

HY000

CLI-specific condition

HY001

Memory allocation error

HY003

Invalid data type in application descriptor

HY004

Invalid data type

HY007

Associated statement is not prepared

HY008

Operation canceled

HY009

Invalid use of null pointer

HY010

Function sequence error

HY011

Attribute cannot be set now

HY012

Invalid transaction operation code

HY013

Memory management error

HY014

Limit on the number of handles exceeded

HY015

No cursor name available

HY016

Cannot modify an implementation row descriptor

HY017

Invalid use of an automatically allocated descriptor handle

HY018

Server declined the cancellation request

HY019

Non-string data cannot be sent in pieces

HY020

Attempt to concatenate a null value

HY021

Inconsistent descriptor information

HY024

Invalid attribute value

HY055

Non-string data cannot be used with string routine

HY090

Invalid string length or buffer length

HY091

Invalid descriptor field identifier

HY092

Invalid attribute identifier

HY095

Invalid Function ID specified

HY096

Invalid information type

HY097

Column type out of range

HY098

Scope out of range

HY099

Nullable type out of range

HY100

Uniqueness option type out of range

HY101

Accuracy option type out of range

HY103

Invalid retrieval code

HY104

Invalid Length/Precision value

HY105

Invalid parameter type

HY106

Invalid fetch orientation

HY107

Row value out of range

HY109

Invalid cursor position

HY110

Invalid driver completion

HY111

Invalid bookmark value

HYC00

Optional feature not implemented

HYT00

Timeout expired

HYT01

Connection timeout expired

SQLCLASS XX (Internal Error)

XX000

Internal error

XX001

Data corrupted

XX002

Index corrupted