|
Processing Errors and Exceptions in SQL | Errors and Transactions |
Errors are divided into several groups (in the tables lower) based on the server reactions and on the possibilities of treating the error with a handler.
Many errors cause a transaction rollback. If the error that causes rollback occurs inside an atomic block, then the rollback applies only for this block, the database state returns to the state before this block was entered.
Warnings and information about various situations belongs to this category. These errors don't require a reaction and if they're left untreated, they don't have any effects on operation processing, they never cause rollback. A client may learn of their occurrence by calling the Sz_warning function. The special error EMPTY (nr. 140 - attempt to work with a deleted and freed record) belong here as well.
Only a single error belongs to this group. This error signals depletion of records when going through a cursor. This error is usually treated with a handler. If treated (see example), the transaction is not rolled back and the client doesn't learn about this error. If not treated with a handler, this error causes transaction rollback.
API identifier | number | SQLSTATE | Description |
NOT_FOUND_02000 | 139 | 02000 | FETCH statement moved the cursor position to a nonexistent record |
Errors in this category signal that certain operation couldn't be processed and the client won't get normal result from the server. These errors don't cause transaction rollback. They can't be treated with a handler generally, but fulltext convertor errors can be treated with CONTINUE handler.
API identifier | number | SQLSTATE | Description |
OUT_OF_TABLE | 131 | n/a | record number specified in a function for reading or writing is out of records range in a table or a cursor |
INTERNAL_SIGNAL | 184 | n/a | internal server signal for a client |
NOTHING_TO_REPL | 229 | n/a | replication failed because it's nothing to replicate - an announcement for the opposite side why the replication failed |
CONVERSION_NOT_SUPPORTED | 226 | W0226 | fulltext engine cannot convert the specified text or haven't found the file for indexing |
GERERR_FULLTEXT_CONV | 6005 | W6005 | generic error from an external fulltext convertor |
Errors that belong to this group allow you to continue operation processing after they occur, if you react in a defined way. They can be treated with handlers and if they're treated successfully, no rollback is done, and the database changes are preserved. From the client view there is no error then. If they're not treated, rollback is done.
API identifier | number | SQLSTATE | Description |
THREAD_START_ERROR | 132 | W0132 | system couldn't execute a DETACHED routine |
OBJECT_DOES_NOT_EXIST | 137 | W0137 | some SQL statement wants to use an object that doesn't exist |
CANNOT_CONVERT_DATA | 141 | W0141 | data conversion in FETCH INTO can't be done |
STRING_CONV_NOT_AVAIL | 185 | W0185 | conversion or string comparison failed, because the needed charsets are not available; if treated with a handler, the conversion returns NULL and the comparison TRUE |
SQ_INVALID_CURSOR_STATE | 196 | 24000 | invalid cursor state, e.g. when it's already closed |
SQ_SAVEPOINT_INVAL_SPEC | 197 | 3B001 | invalid savepoint designation |
SQ_TRANS_STATE_ACTIVE | 199 | 25001 | transaction already in progress |
SQ_INVAL_TRANS_TERM | 200 | 2D000 | forbidden transaction termination in an atomic statement |
SQ_TRANS_STATE_RDONLY | 201 | 25006 | this transaction may not modify data |
SQ_NUM_VAL_OUT_OF_RANGE | 202 | 22003 | number value out of range (occurrence of this error depends on the compatibility setting SQLOPT_MASK_NUM_RANGE) |
SQ_INV_CHAR_VAL_FOR_CAST | 203 | 22018 | invalid character prohibits the type conversion (occurrence of this error depends on the compatibility setting SQLOPT_MASK_INV_CHAR) |
SQ_STRING_DATA_RIGHT_TRU | 204 | 22001 | character string too long, truncated from the right (occurrence of this error depends on the compatibility setting SQLOPT_MASK_RIGHT_TRUNC) |
SQ_DIVISION_BY_ZERO | 205 | 22012 | division by zero in a SQL statement |
SQ_CARDINALITY_VIOLATION | 206 | 21000 | query result (e.g. after SELECT INTO) contains more records than one |
SQ_INVALID_ESCAPE_CHAR | 207 | 22019 | error in specifying the ESCAPE operator in the LIKE predicate |
SQ_CASE_NOT_FOUND_STMT | 208 | 20000 | SQL statement CASE doesn't contain a suitable branch |
SQ_RESIGNAL_HND_NOT_ACT | 210 | OK000 | RESIGNAL statement used outside condition handling |
SQ_EXT_ROUT_NOT_AVAIL | 211 | 38001 | extern routine not found in the specified library (DLL or so) |
SQ_NO_RETURN_IN_FNC | 212 | 2F001 | no RETURN statement in a SQL function |
SQ_INVALID_CURSOR_NAME | 217 | 34000 | cursor of such name doesn't exist |
LIBRARY_ACCESS_DISABLED | 223 | W0223 | extern function called from a prohibited folder (folder is enabled by the Dir property) |
LIBRARY_NOT_FOUND | 224 | W0224 | extern library DLL or so not found |
WONT_RUN_AS_ROOT | 228 | W0228 | extern function cannot be called, if the linux server runs under the root account |
SCHEMA_IS_OPEN | 236 | W0236 | cannot delete an application (scheme), if it's opened by another client (thread) |
GENERR_DAD_DESIGN | 6000 | W6000 | error in DAD design |
GENERR_XERCES_INIT | 6001 | W6001 | error when initializing xerces libraries |
GERERR_DAD_PARSING | 6003 | W6003 | error when analyzing the XML structure of DAD |
All user defined exceptions also belong to this category, unless they're bound to a SQLSTATE that belongs to another category. Exceptions are activated with the SIGNAL or RESIGNAL statements and further process is the same as when the error occurred.
Errors that don't allow you to continue operation processing after their occurrence belong to this group. Rollback is necessary when these errors occur. If a handler is available, you can do some further actions, but you can't prevent the rollback (handler is executed after the rollback).
Errors from this category are not handled inside triggers. Handler is ignored in such case.
API identifier | number | SQLSTATE | Description |
NOT_LOCKED | 136 | W0136 | cannot lock a record open by another client |
MUST_NOT_BE_NULL | 160 | 40002 | cannot write NULL value into the column that may not be NULL |
REFERENCED_BY_OTHER_OBJECT | 162 | W0162 | cannot delete a table or remove an index from a table, which is related to some table with a referential integrity, or cannot delete a domain used in the table definition |
DEADLOCK | 171 | W0171 | deadlock, some clients are blocking each other |
KEY_DUPLICITY | 172 | 40004 | key duplicity in a unique index |
CHECK_CONSTRAIN | 174 | 40005 | table integrity constraint broken |
REFERENTIAL_CONSTRAIN | 175 | 40006 | table referential integrity broken |
TABLE_IS_FULL | 177 | W0177 | record count in a table out of range |
TOO_COMPLEX_TRANS | 183 | W0183 | transaction too complex |
ASSERTION_FAILED | 195 | W0195 | internal error |
SQ_SAVEPOINT_TOO_MANY | 198 | 3B002 | limit for savepoint count or open atomic blocks exceeded |
SEQUENCE_EXHAUSTED | 219 | W0219 | sequence has reached the maximum value and cycling is not enabled |
NO_CURRENT_VAL | 220 | W0220 | CURVAL was executed before NEXTVAL, and is not available |
OBJECT_VERSION_NOT_AVAILABLE | 230 | W0230 | requested object version no longer exists |
GERERR_XML_PARSING | 6002 | W6002 | XML document analysis error when importing |
This is a group of critical errors. Server cannot continue operating when these errors occur and it cannot be expected that a handler can treat these errors. Handlers cannot be defined for these errors. Transaction rollback is done and the client gets an error message. Signals on untreated exceptions also belong to this group.
API identifier | number | Description |
OUT_OF_KERNEL_MEMORY | 145 | server out of memory |
UNREADABLE_BLOCK | 152 | disk block unreadable - internal error |
OUT_OF_BLOCKS | 154 | disk is out of space, serious error that may cause serious damage to the database file. |
163-167 | internal errors, usually database file damage | |
TABLE_DAMAGED | 168 | database table seriously damaged |
INDEX_DAMAGED | 191 | index damaged |
SQ_UNHANDLED_USER_EXCEPT | 209 | user defined exception not handled |
SQ_TRIGGERED_ACTION | 214 | error in an action executed by a trigger |
FRAMES_EXHAUSTED | 232 | internal error, disk frames exhausted |
The causes and solutions of these errors lie outside of SQL. These errors are usually caused by prohibited or incorrect client requests. They appear usually when debugging an application using the program server interface (API) as a result of passing wrong parameters into the server functions. Each of these errors causes transaction rollback and operation termination. Error message is sent to the client. These errors can't be treated with handlers on the server, but the client may do the proper action.
API identifier | number | Description |
BAD_MODIF | 128 | program is trying to work with multiattributes or with columns with variable length as with normal columns or vice versa. |
NO_RIGHT | 129 | user hasn't sufficient privileges to access data |
BAD_ELEM_NUM | 130 | invalid number of table column or cursor |
CURSOR_MISUSE | 133 | invalid cursor number (e.g. when trying to use a cursor that is not opened yet, or already closed cursor or somebody else's cursor) |
BAD_OPCODE | 134 | undefined client-server request |
CANNOT_APPEND | 135 | cursor doesn't allow this operation (e.g. INSERT into JOIN or DELETE CURRENT OF on INSENSITIVE cursor etc.) |
INDEX_OUT_OF_RANGE | 138 | index of multiattribute value or the value count is out of range according to the table definition |
BAD_PASSWORD | 142 | wrong password on user login |
PTR_TO_DELETED | 143 | database pointer points to a discarded record |
NIL_PTR | 144 | database pointer points nowhere |
RECORD_DOES_NOT_EXIST | 146 | attempt to work with a nonexisting record |
IS_DELETED | 147 | attempt to work with a deleted record in a cursor or with a nonexisting table |
INDEX_NOT_FOUND | 148 | index not found |
OBJECT_NOT_FOUND | 149 | object in application not found |
BAD_DATA_SIZE | 151 | client passed data of incorrect length to the server |
NOT_LOGGED_IN | 153 | client haven't yet logged in the server |
REQUEST_BREAKED | 155 | operation was canceled by a client during its processing |
OS_FILE_ERROR | 157 | error while working with a file (this may occur both for a client and for a server) |
INCOMPATIBLE_VERSION | 158 | file version incompatible with data (*.TDT) |
OPERATION_DISABLED | 161 | client is connected without a licence with restricted privileges and tries to execute a prohibited operation |
CANNOT_LOCK_KERNEL | 169 | cannot lock server for operation execution, other users are connected to the server |
ROLLBACK_IN_CURSOR_CREATION | 170 | Rollback was made when creating a cursor |
UNPROPER_TYPE | 176 | column type not suitable for the specified function |
ERROR_IN_FUNCTION_ARG | 180 | argument value error in API function |
NO_WRITE_TOKEN | 186 | no write token valid |
WAITING_FOR_ACKN | 187 | waiting for confirmation of previous replication |
REPL_BLOCKED | 188 | replication is not yet enabled by the other side |
PASSWORD_EXPIRED | 192 | password validity expired, new password required |
NO_KEY_FOUND | 193 | cannot sign, no certified key found |
DIFFERENT_KEY | 194 | cannot sign, different key used |
COLUMN_NOT_EDITABLE | 213 | cannot overwrite query column that is not editable |
REPLICATION_NOT_RUNNING | 215 | replication not running |
ROLE_FROM_DIFF_APPL | 218 | trying to set role privileges from different application (may occur when sharing back-end or front-end) |
NO_WWW_LICENCE | 221 | Internet licence for WWW access not found |
NO_MORE_INTRANET_LICS | 222 | too few intranet licences, another client refused |
LANG_SUPP_NOT_AVAIL | 225 | fulltext language support not installed |
NO_FULLTEXT_LICENCE | 227 | no Fulltext extension licence found on SQL server |
NO_REPL_UNIKEY | 231 | table doesn't contain replication key |
NO_CONF_RIGHT | 233 | user is not configuration administrator and may not carry out the operation |
NO_SECUR_RIGHT | 234 | user is not security administrator and may not carry out the operation |
ACCOUNT_DISABLED | 235 | user account blocked by an administrator |
NO_XML_LICENCE | 238 | no XML extension licence found on SQL server |
This group of errors is outside the transaction system and doesn't affect running transactions. These errors occur at the client, or on the edge between client and server. Otherwise these errors are similar to the previous group.
API identifier | number | Description |
NOT_ANSWERED | 255 | operation not finished (for asynchronous transaction) |
OUT_OF_APPL_MEMORY | 150 | client out of application memory |
CONNECTION_LOST | 156 | client connection to the server lost, the server is terminated or the network connection is down |
REJECTED_BY_KERNEL | 159 | client request not processed - special server state, e.g. consistency check etc. |
BAD_VERSION | 173 | client and server version don't match |
REQUEST_NESTING | 178 | client request nested - new request sent before the previous is complete |
CANNOT_FOR_ODBC | 179 | operation not executable for ODBC cursor |
ODBC_CURSOR_NOT_OPEN | 181 | selected ODBC cursor not open |
DRIVER_NOT_CAPABLE | 182 | ODBC driver unable to process requested operation |
BAD_TABLE_PROPERTIES | 190 | bad table properties |
ERROR_IN_FUNCTION_CALL | 237 | error in API function call found by the client |
Processing Errors and Exceptions in SQL | Errors and Transactions |