SQL Error Messages
The table below lists the SQL numeric error codes and their error messages for InterSystems IRIS® data platform. These codes are returned as the SQLCODE variable value.
While this document lists error codes as negative values, JDBC and ODBC clients always receive positive values. For example, if an ODBC or JDBC application returns error code 30, look up error code -30 in this table.
SQLCODE 0 and 100
There are two SQLCODE values that do not represent an SQL error:
Error Code | Description |
---|---|
0 | Successful Completion |
100 | No (more) data |
-
SQLCODE=0 indicates successful completion of an SQL operation. For a SELECT statement, this usually means the successful retrieval of data from a table. However, if the SELECT performs an aggregate operation, (for example: SELECT SUM(myfield)) the aggregate operation is successful and an SQLCODE=0 is issued even when there is no data in myfield; in this case SUM returns NULL and %ROWCOUNT=1.
-
SQLCODE=100 indicates that the SQL operation was successful, but found no data to act upon. This can occur for a number of reasons. For a SELECT these include: the specified table contains no data; the table contains no data that satisfies the query criteria; or row retrieval has reached the final row of the table. For an UPDATE or DELETE these include: the specified table contains no data; or the table contains no row of data that satisfies the WHERE clause criteria. In these cases %ROWCOUNT=0.
In Embedded SQL, when SQLCODE=100 the output host variables specified in the INTO clause are nulled.
SQLCODE -400
The SQLCODE -400 error “Fatal error occurred” is a general error. It is generated when a more specific SQLCODE error code is not available.
Retrieving SQL Message Texts
To determine the meaning of an SQLCODE numeric code, use the following ObjectScript statement:
WRITE "SQLCODE=",$SYSTEM.SQL.Functions.SQLCODE(-nnn)
This SQLCODE()Opens in a new tab method can also be called as a stored procedure: %SYSTEM_SQL.Functions_SQLCODE(-nnn).
When possible (usually at SQL compile time), error messages include the name of the field, table, view, or other element that caused the error. Placeholders for these names are shown using the <name> syntax convention.
The %msg variable may contain an additional message error text for certain errors. For further details, refer to System Variables.
The message texts returned are shown below in their English versions. The actual message text returned depends upon your locale setting.
For information on generating ObjectScript general errors from SQLCODE errors, see the %SYSTEM.ErrorOpens in a new tab class.
Table of SQL Error Codes and Messages
For ease of use, the SQL Error Codes Table has been divided into the following sub-tables:
Error Code | Description |
---|---|
-1 | Invalid SQL statement |
-2 | Exponent digits missing after 'E' |
-3 | Closing quote (") missing |
-4 | A term expected, beginning with one of the following: identifier, constant, aggregate, %ALPHAUP, %EXACT, %MVR, %SQLSTRING, %SQLUPPER, %STRING, %UPPER, $$, :, +, -, (, NOT, EXISTS, or FOR |
-5 | Column number specified in ORDER does not match SELECT list |
-6 | ORDER BY column after UNION not found as SELECT column |
-7 | Exponent out of range |
-8 | Invalid DATEPART code for DATEPART(), DATENAME(), DATEADD(), or DATEDIFF() |
-9 | Incompatible SELECT lists used in UNION |
-10 | The SELECT list of the subquery must have exactly one item |
-11 | A scalar expression expected, not a condition |
-12 | A term expected, beginning with one of the following: identifier, constant, aggregate, $$, :, (, +, -, %ALPHAUP, %EXACT, %MVR, %SQLSTRING, %SQLUPPER, %STRING, or %UPPER |
-13 | An expression other than a subquery expected here |
-14 | A comparison operator is required here |
-15 | A condition expected after NOT |
-16 | Quantifier SOME expected after the FOR in the for-expression |
-17 | A for-condition expected after the ( in the for-expression |
-18 | IS (or IS NOT) NULL predicate can be applied only to a field |
-19 | An aggregate function cannot be used in a WHERE or GROUP BY clause |
-20 | Name conflict in the FROM list over label |
-21 | Pointer->Field reference may not be modified by an INSERT or UPDATE statement |
-22 | ORDER must specify column names, not numbers, when after 'SELECT *' |
-23 | Label is not listed among the applicable tables |
-24 | Ambiguous sort column |
-25 | Input encountered after end of query |
-26 | Missing FROM clause |
-27 | Field is ambiguous among the applicable tables |
-28 | Host variable name must begin with either % or a letter |
-29 | Field not found in the applicable tables |
-30 | Table or view not found |
-31 | Field not (found/unique) in table(s) |
-32 | Outer-join symbol ( =* or *= ) must be between two fields |
-33 | No field(s) found for table |
-34 | Optimizer failed to find a usable join order |
-35 | INSERT/UPDATE/DELETE not allowed for non-updateable view |
-36 | WITH CHECK OPTION (CHECKOPTION class parameter) not allowed for non-updateable views |
-37 | SQL Scalar/Aggregate/Unary function not supported for Stream fields |
-38 | No master map for table |
-39 | No RowID field for table |
-40 | ODBC escape extension not supported |
-41 | An extrinsic function call must have the form '$$tag^routine(...)' |
-42 | Closing quotes ("") missing following pattern match |
-43 | Table is ambiguous within #IMPORT schema name list |
-44 | Duplicate method or query characteristic |
-45 | Duplicate method in ObjectScript query body |
-46 | Required method missing in ObjectScript query body |
-47 | Invalid method or query characteristic |
-48 | Invalid trigger REFERENCING clause for the trigger's event |
-49 | Trigger REFERENCING clause cannot be specified when trigger language not SQL |
-50 | Trigger specifies UPDATE OF <fieldlist> clause when trigger language not SQL |
-51 | SQL statement expected |
-52 | Cursor (Already/Was Not) DECLAREd |
-53 | Constant or variable expected as new value |
-54 | Array designator (last subscript omitted) expected after VALUES |
-55 | Invalid GRANT <role> TO or REVOKE <role> FROM |
-56 | GRANT/REVOKE Action not applicable to an object of this type |
-57 | Trigger specifies WHEN clause when trigger language not SQL |
-58 | Duplicate field found in trigger UPDATE OF <fieldlist> clause |
-59 | Cannot have more than one field |
-60 | An action (%ALTER, SELECT, UPDATE, etc.) expected |
-61 | Cursor not updateable |
-62 | Additional new values expected for INSERT/UPDATE |
-63 | Data exception - invalid escape character |
-64 | Incompatible SELECT list is used in INSERT |
-65 | Positive integer constant or variable expected |
-66 | Redundant fields found in SELECT list |
-67 | Implicit join (arrow syntax) not supported in ON clause |
-68 | Legacy outer join (=*, *=) not supported in ON clause |
-69 | SET <field> = <value expression> not allowed with WHERE CURRENT OF <cursor> |
-70 | Multi-Line field only valid for LIKE, Contains ([), or NULL Comparison. |
-71 | Multi-Line field must be the left operand of the Comparison. |
-72 | Multi-Line field not valid in ORDER BY clause |
-73 | Aggregates not supported in ORDER BY clause |
-74 | Duplicate <select-list> alias names found |
-75 | <trim_spec> and/or <trim_char> required before FROM in TRIM function. |
-76 | Cardinality mismatch between the SELECT-list and INTO-list. |
-77 | Qualified column reference not allowed in this JOIN context. |
-78 | Invalid transaction state. |
-79 | Referencing key and referenced key must be the same size |
-80 | Integer expected |
-81 | Column Constraint expected |
-82 | Multiple table %DESCRIPTION definitions found |
-83 | Multiple table %FILE definitions found |
-84 | Multiple table %NUMROWS definitions found |
-85 | Multiple table %ROUTINE definitions found |
-86 | Invalid field definition, no datatype defined |
-87 | Invalid table name |
-88 | Invalid field name |
-89 | Invalid index name |
-90 | Invalid view name |
-91 | Transaction mode cannot be specified more than once |
-92 | Level of isolation cannot be READ UNCOMMITTED or READ VERIFIED if READ WRITE specified |
-93 | number of conditions for the DIAGNOSTICS SIZE must be exact numeric |
-94 | Unsupported usage of OUTER JOIN |
-95 | Operation disallowed by operation table |
-96 | Specified level of isolation is not supported |
-97 | Duplicate select-list names found. |
-98 | License violation |
-99 | Privilege violation |
Error Code | Description |
---|---|
-101 | Attempt to open a cursor that is already open |
-102 | Operation (FETCH/CLOSE/UPDATE/DELETE/...) attempted on an unopened cursor |
-103 | Positioned UPDATE or DELETE attempted, but the cursor is not positioned on any row |
-104 | Field validation failed in INSERT, or value failed to convert in DisplayToLogical or OdbcToLogical |
-105 | Field validation failed in UPDATE |
-106 | Row to DELETE not found |
-107 | Cannot UPDATE RowID or RowID based on fields |
-108 | Required field missing; INSERT or UPDATE not allowed |
-109 | Cannot find the row designated for UPDATE |
-110 | Locking conflict in filing |
-111 | Cannot INSERT into a 'Default Only' RowID or RowID based on field |
-112 | Access violation |
-113 | %THRESHOLD violation |
-114 | One or more matching rows is locked by another user |
-115 | Cannot INSERT/UPDATE/DELETE on a read only table |
-116 | Cardinality mismatch on INSERT/UPDATE between values list and number of table columns. |
-117 | Aggregates not supported in views |
-118 | Unknown or non-unique User or Role |
-119 | UNIQUE or PRIMARY KEY constraint failed uniqueness check upon INSERT |
-120 | UNIQUE or PRIMARY KEY constraint failed uniqueness check upon UPDATE |
-121 | FOREIGN KEY constraint failed referential check upon INSERT of row in referencing table |
-122 | FOREIGN KEY constraint failed referential check upon UPDATE of row in referencing table |
-123 | FOREIGN KEY constraint failed referential check upon UPDATE of row in referenced table |
-124 | FOREIGN KEY constraint failed referential check upon DELETE of row in referenced table |
-125 | UNIQUE or PRIMARY KEY Constraint failed uniqueness check upon creation of the constraint |
-126 | REVOKE with RESTRICT failed. |
-127 | FOREIGN KEY Constraint failed referential check upon creation of the constraint |
-128 | Argument to scalar function %OBJECT() must be a stream field |
-129 | Illegal value for SET OPTION locale property |
-130 | Before Insert trigger failed |
-131 | After Insert trigger failed |
-132 | Before Update trigger failed |
-133 | After Update trigger failed |
-134 | Before Delete trigger failed |
-135 | After Delete trigger failed |
-136 | View's WITH CHECK OPTION validation failed in INSERT |
-137 | View's WITH CHECK OPTION validation failed in UPDATE |
-138 | Cannot INSERT/UPDATE a value for a read only field |
-139 | Concurrency failure on update: row versions not the same |
-140 | Invalid length parameter passed to the SUBSTRING function |
-141 | Invalid input value passed to the CONVERT function |
-142 | Cardinality mismatch between the view-column-list and view query's SELECT clause |
-143 | ORDER BY not valid in a view's query |
-144 | A subquery is not allowed in an insert statement's set/values clause |
-146 | Unable to convert date input to a valid logical date value |
-147 | Unable to convert time input to a valid logical time value |
-148 | CREATE VIEW, ALTER VIEW, or a view's query may not contain host variable references |
-149 | SQL Function encountered an error |
-150 | Optimistic concurrency locking for a class definition failed |
-151 | Index is not found within tables used by this statement |
-152 | Index is ambiguous within tables used by this statement |
-153 | SQL compile options comment contains invalid JSON string |
-154 | Cannot UPDATE fields that are part of the shard key |
-155 | INSERT/UPDATE into external (linked) cannot use an array variable for input of new values |
-161 | References to an SQL connection must constitute a whole subquery |
-162 | SQL Connection is not defined |
-163 | Heterogeneous queries via the JDBC gateway are not supported |
-178 | Cannot apply partition range compiling embedded cached query |
-180 | Model name not unique |
-181 | Model or Trained Model not found |
-182 | No query is defined for the model |
-183 | Predicting Column cannot appear in the specified WITH column list |
-184 | Provider class not found |
-185 | Predicting Column only has one unique value in the dataset |
-186 | Model's Provider is unavailable on this instance |
-187 | ML Configuration not found |
-188 | ML Configuration property is not supported for this provider |
-189 | Cannot DROP the System Default ML Configuration |
-190 | IntegratedML not permitted with current license |
-191 | Model has no default trained model. It may not have been trained. |
-192 | ML Configuration name not unique |
-193 | Model Column / With Column type mismatch |
-194 | Cannot specify NOT DEFAULT when the Trained Model name is the same as the Model's DefaultTrainedModel |
-201 | Table or view name not unique |
-220 | Gateway query error |
-221 | Gateway query GetConnection() failed |
-222 | Gateway query AllocStatement() failed |
-223 | Gateway query Prepare() failed |
-225 | Gateway query BindParameters() failed |
-226 | Gateway query Execute() failed |
-227 | Gateway query Fetch() failed |
-228 | Gateway query GetData() failed |
-229 | Foreign table query error |
-230 | Foreign tables Execute() failed |
-231 | Foreign tables Fetch() failed |
-232 | Foreign tables Close() failed |
-233 | Cardinality mismatch between COLUMNS/VALUES clause and number of table columns |
-234 | Invalid foreign server type |
-235 | Invalid foreign data wrapper |
-241 | Parallel query queue error |
-242 | Parallel query run-time error |
-251 | Sharded query queue error |
-252 | Sharded query run-time error |
-253 | Sharded INSERT/UPDATE/DELETE run-time error |
-300 | DDL not allowed on this table definition |
-301 | No Savepoint name |
-302 | Savepoint names starting with "SYS" are reserved |
-303 | No implicit conversion of Stream value to non-Stream field in UPDATE assignment is supported |
-304 | Attempt to add a NOT NULL field with no default value to a table which contains data |
-305 | Attempt to make field required when the table has one or more rows where the column value is NULL |
-306 | Column with this name already exists |
-307 | Primary key already defined for this table |
-308 | Identity column already defined for this table |
-309 | The left operand of %CONTAINS is not a property that supports the %Text interface |
-310 | Foreign key references non-existent table |
-311 | Foreign key with same name already defined for this table |
-312 | Invalid schema name. Must use delimited identifiers to reference this schema name |
-313 | Condition expression not supported for Stream fields |
-314 | Foreign key references non-unique key/column collection |
-315 | Constraint or Key not found |
-316 | Foreign key references non-existent key/column collection |
-317 | Cannot DROP Constraint - One or more Foreign Key constraints reference this Unique constraint |
-319 | Referenced table has no primary key defined |
-320 | Cannot DROP table - One or more Foreign Key constraints reference this table |
-321 | Cannot DROP view - One or more views reference this view |
-322 | Cannot DROP column — column is defined on one or more indexes or constraints |
-324 | Index with this name already defined for this table |
-325 | Index cannot be dropped because it is the IDKEY index and the table has data |
-326 | Duplicate TUNE TABLE option clause found |
-327 | Duplicate table option found |
-328 | Duplicate foreign server option found |
-329 | Required foreign server option missing |
-333 | No such index defined |
-334 | Index name is ambiguous. Index found in multiple tables. |
-340 | No such database (namespace) defined |
-341 | Database file already exists |
-342 | Cannot delete system namespace |
-343 | Invalid database name |
-344 | Cannot drop database that you are currently using or connected to |
-350 | An unexpected error occurred executing SqlComputeCode |
-356 | SQL Function (function stored procedure) is not defined to return a value |
-357 | SQL Function (function stored procedure) is not defined as a function procedure |
-358 | SQL Function (function stored procedure) name not unique |
-359 | SQL Function (function stored procedure) not found |
-360 | Class not found |
-361 | Method or Query name not unique |
-362 | Method or Query not found |
-363 | Trigger not found |
-364 | Trigger with same EVENT, TIME, and ORDER already defined |
-365 | Trigger name not unique |
-366 | Schema name mismatch between trigger name and table name |
-370 | SQL CALL, more arguments specified than defined in the stored procedure |
-371 | :HVar = CALL ... Specified for a procedure which does not return a value |
-372 | Support for extrinsic function calls are disabled |
-373 | An extrinsic function call may not call a % routine |
-374 | Cannot alter the datatype of a field to/from a stream type when the table contains data |
-375 | Cannot ROLLBACK to unestablished savepoint |
-376 | Unsupported CAST target specified |
-377 | Field appears more than once in assignment list of insert or update statement |
-378 | Datatype mismatch, explicit CAST is required |
-380 | Invalid or Missing argument to scalar function |
-381 | Too many arguments to scalar function |
-382 | CTE name defined more than once |
-383 | CTE used for any statement type other than select |
Error Code | Description |
---|---|
-400 | Fatal error occurred |
-401 | Fatal Connection error |
-402 | Invalid Username/Password |
-405 | Unable to read from communication device |
-406 | Unable to Write to Server |
-407 | Unable to Write to Server Master |
-408 | Unable to start server |
-409 | Invalid server function |
-410 | Invalid Directory |
-411 | No stream object defined for field |
-412 | General stream error |
-413 | Incompatible client/server protocol |
-415 | Fatal error occurred within the SQL filer |
-416 | Info Error |
-417 | Security Error |
-422 | SELECT request processed via ODBC, JDBC, or Dynamic SQL cannot contain an INTO clause |
-425 | Error processing stored procedure request |
-426 | Error preparing stored procedure |
-427 | Invalid stored procedure name |
-428 | Stored procedure not found |
-429 | Invalid number of input/output parameters for stored procedure |
-430 | Cannot initialize procedure context |
-431 | Stored procedure parameter type mismatch |
-432 | Function returned multiple rows when only a single value is expected |
-450 | Request timed out due to user timeout |
-451 | Unable to receive server message |
-452 | Message sequencing error |
-453 | Error in user initialization code |
-454 | Error sending external interrupt request |
-456 | SQL query execution interrupted by user |
-459 | Kerberos authentication failure |
-460 | General error |
-461 | Communication link failure |
-462 | Memory allocation failure |
-463 | Invalid column number |
-464 | Function sequence error |
-465 | Invalid string or buffer length |
-466 | Invalid parameter number |
-467 | Column type out of range |
-468 | Fetch type out of range |
-469 | Driver not capable |
-470 | Option value changed |
-471 | Duplicate cursor name |
-472 | A collection-valued property was expected |
-473 | Schema not found |
-474 | Explain does not support the following SQL statement type: INSERT |
-475 | Schema is not empty |
-476 | Schema already exists |
-478 | Query recompiled: Result Set mismatch |
-500 | Fetch row count limit reached |
Error Code | Description |
---|---|
-10050 | WinSock: Network is down |
-10051 | WinSock: Network is unreachable |
-10052 | WinSock: Net dropped connection or reset |
-10054 | WinSock: Connection reset by peer (due to timeout or reboot) |
-10055 | WinSock: No buffer space available |
-10056 | WinSock: Socket is already connected |
-10057 | WinSock: Socket is not connected |
-10058 | WinSock: Cannot send after socket shutdown |
-10060 | WinSock: Connection timed out |
-10061 | WinSock: Connection refused |
-10064 | WinSock: Host is down |
-10065 | WinSock: No route to host |
-10070 | WinSock: Stale NFS file handle |
-10091 | WinSock: Network subsystem is unavailable |
-10092 | WinSock: WINSOCK DLL version out of range |
-10093 | WinSock: Successful WSASTARTUP not yet performed |
-11001 | WinSock: Host not found |
-11002 | WinSock: Nonauthoritative host not found |