Reference
IBM i errors
- -007 Character not valid in the statement The statement contains a character SQL does not accept: typically typographic quotes pasted from Word, Teams or an email. SQL0007
- -010 String constant not delimited A string is missing its closing quote, or a quote inside the text is not doubled ('O'Brien'). SQL0010
- -104 Token not valid Syntax error: a missing or extra comma, unbalanced parentheses, a keyword in the wrong place. The message gives the token and a partial list of valid ones; the error can also be before the token. SQL0104
- -117 Wrong number of values In an INSERT the number of values does not match the number of columns, often because the column list is omitted and the table has more columns than you think. SQL0117
- -119 Column not valid in HAVING HAVING contains a column or expression that is neither in an aggregate function nor in GROUP BY. SQL0119
- -122 Column not grouped in SELECT The SELECT has a column that is not in GROUP BY and not inside an aggregate function. SQL0122
- -138 Argument of substring function not valid SUBSTR (or LEFT, or OVERLAY) with a start position or length beyond the string's length, or an argument that is not an integer. SQL0138
- -150 View, index or table is read-only INSERT, UPDATE, DELETE or MERGE on a view or logical file that can only be read: DISTINCT, GROUP BY, aggregates, several tables, UNION, all columns computed. SQL0150
- -151 Column not updatable An attempt to update a view column derived from an expression, a constant or a special register. SQL0151
- -158 Number of columns not consistent In CREATE VIEW or CREATE TABLE AS the list of column names has a different number of entries from the SELECT that follows. SQL0158
- -170 Number of arguments not valid A function is called with too many or too few arguments. SQL0170
- -171 Argument of function not valid Type, length or value of an argument the function does not accept (a number where a string is needed, a negative length). SQL0171
- -180 Syntax of date, time or timestamp not valid A string converted to date, time or timestamp does not match the expected format: for example '10/05/2026' when the job uses *ISO. SQL0180
- -181 Value in date, time or timestamp out of range The string has the right format but the date does not exist: '2026-02-30', '0000-00-00'. Classic when converting numeric dates holding zeros or 99999999. SQL0181
- -183 Result of date arithmetic out of range Adding or subtracting durations takes the date before 0001-01-01 or after 9999-12-31. SQL0183
- -199 Keyword not expected A keyword in the wrong place, for example clauses in the wrong order (ORDER BY before WHERE). SQL0199
- -203 Name is ambiguous In a join a column with the same name exists in several tables and is not qualified. SQL0203
- -204 Object not found The table or object is not found. On IBM i the most common cause is the naming convention: with SQL naming an unqualified name is looked up in the default schema (usually the one named after the user), not in the library list. SQL0204
- -205 Column not in table The column, qualified with a table name or correlation name, is not in that table. SQL0205
- -206 Column or global variable not found The column is not in any table in FROM: a typo, or a column from another table or another view. SQL0206
- -208 ORDER BY column not in result table With UNION, EXCEPT or INTERSECT, ORDER BY uses a column that is not a named column of the result. SQL0208
- -302 Conversion error on an input variable The value of a variable or parameter cannot be converted for the statement: too long, out of range or invalid. The message gives the error type. SQL0302
- -303 Variable not compatible or value too long The returned value cannot be assigned to the variable: incompatible types, or a variable that is too short. SQL0303
- -304 Conversion error assigning to a variable The returned value does not fit in the variable: typical with SUM or COUNT into variables sized too small. SQL0304
- -305 Indicator variable required The query returns NULL and the variable has no indicator. It often happens with outer joins, or with MAX and SUM when no row matches. SQL0305
- -312 Variable not defined or not usable The precompiler cannot find or use the variable: wrong name, a variable of another procedure, or a type with no SQL equivalent. The message gives a reason code. SQL0312
- -313 Number of host variables not valid In EXECUTE ... USING or OPEN ... USING the number of variables does not match the parameter markers (?) of the prepared statement. SQL0313
- -401 Comparison operands not compatible A comparison between types Db2 for i cannot compare. Numbers and characters, instead, do compare: the string is converted, and if it holds no number the error is a different one (-420). SQL0401
- -404 Value too long for column or variable In INSERT, UPDATE, MERGE or SET a string is longer than the column or variable. The message gives both lengths. SQL0404
- -406 Conversion error assigning to a column A computed or converted numeric value does not fit in the target column. The message gives the error type (1 is overflow). SQL0406
- -407 NULL in a column that does not allow it INSERT, UPDATE or MERGE puts NULL in a NOT NULL column. Often the column was left out of the INSERT and has no default. SQL0407
- -408 Value not compatible with the column The value assigned has a type that cannot go into that column. Assignments between numbers and characters are allowed (and if the text is not a number the error is -420). SQL0408
- -412 Subselect returns more than one column A subquery used in a comparison or in IN with a single expression returns more than one column. SQL0412
- -420 Value for cast argument not valid A string converted to a number contains characters that are not a number: CAST('12A' AS INT), embedded blanks, a comma instead of a decimal point. SQL0420
- -433 Significant data truncated during CAST A CAST to a character type (or XMLCAST, XMLSERIALIZE) has a length too short to hold the value. SQL0433
- -443 Trigger program or external routine detected an error An external program (RPG, CL, Java) used as a trigger, procedure or function failed and returned the error to SQL. SQL0443
- -501 Cursor not open FETCH or CLOSE on a cursor that is not open, often because the OPEN failed and SQLCODE was not checked. SQL0501
- -502 Cursor already open OPEN on a cursor that is still open. Typical when the program is called again in the same activation group without having closed the cursor the previous time. SQL0502
- -504 Cursor not declared The cursor is used before its DECLARE in the source. The precompiler reads the source in physical order, not in execution order. SQL0504
- -508 Cursor not positioned on a locked row UPDATE or DELETE WHERE CURRENT OF after the FETCH returned +100, or before any FETCH. SQL0508
- -518 Prepared statement not found EXECUTE of a statement that was not prepared, often because the PREPARE failed and the error was not checked. SQL0518
- -530 Foreign key violation INSERT, UPDATE or MERGE with a foreign key value that does not exist in the parent table. SQL0530
- -532 Delete prevented by referential constraint DELETE of a parent row that has child rows, with a RESTRICT or NO ACTION rule. SQL0532
- -545 CHECK constraint violation The inserted or updated row does not satisfy a CHECK constraint on the table. SQL0545
- -551 Not authorized to object The user lacks the authority needed on the table, view or routine. SQL0551
- -552 Not authorized to operation The user cannot perform the operation. Each statement has its own requirement: CREATE TABLE needs *USE on the CRTPF command, CREATE VIEW and CREATE INDEX on CRTLF, CREATE SCHEMA on CRTLIB. SQL0552
- -601 Object already exists CREATE (or RENAME) of a table, view, index or alias with a name already used in the schema. SQL0601
- -603 Unique index cannot be created because of duplicate keys CREATE UNIQUE INDEX, or a UNIQUE constraint, on a table that already holds duplicate values for that key. SQL0603
- -802 Data conversion or data mapping error On IBM i the most frequent cause is invalid decimal data in DDS tables (packed fields with blanks): error type 6. Then division by zero (type 8) and overflow (type 1). SQL0802
- -803 Duplicate key value INSERT or UPDATE that violates a primary key, a UNIQUE constraint or a unique index. SQL0803
- -811 SELECT returns more than one row A SELECT INTO, or a subquery used in a comparison, returns more than one row. SQL0811
- -901 SQL system error An internal error. The detail is not in the SQLCODE but in the earlier job log messages. SQL0901
- -904 Resource limit exceeded A limit was exceeded: the message gives which one as a type. The most frequent: the user profile storage limit (type 1), a query resource limit (type 3), the maximum table size (type 6). SQL0904
- -910 Object has a pending change The object has an uncommitted change made under commitment control that blocks the operation: for example a DDL not yet committed. SQL0910
- -913 Row or object in use Another job holds a lock on the row or table, and the wait time runs out. When the system knows, the message names the job holding the lock. SQL0913
- -952 Processing of the SQL statement ended The statement was stopped before completing. Reason code 1 means a cancel request from the client (ODBC, JDBC), often a timeout. SQL0952
- -7007 COMMIT, ROLLBACK or SAVEPOINT not valid The program issues COMMIT, ROLLBACK or SAVEPOINT but commitment control is not active: for example it was compiled with COMMIT(*NONE). SQL7007
- -7008 Object not valid for operation The most common cause is a table that is not journaled used under commitment control: reason code 3 in the message. ACS Run SQL Scripts and many JDBC clients start with commitment control on. SQL7008
No error matches the search.