Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

Db2 SQLCODE cheat sheet

39 codes, most common first. Each row links to its code page and names the IBM page it was checked against.

Use your browser's Print command for a paper or PDF copy. Open the full Db2 SQLCODEs list.

Db2 SQLCODE cheat sheet · mainframekit.com
CodeKindWhat it meansIBM sourceChecked
-805Package not found in planNegative SQLCODEAn application used a package that Db2 could not find in the plan. The reason code in the message says which search failed.Db2 13 for z/OS: SQLCODE -805 (Db2 for z/OS 13.0.0)
-803Duplicate values would violate a unique indexNegative SQLCODEAn insert or update would create duplicate values in columns that a unique index, primary key, unique constraint or hash key requires to be unique.Db2 13 for z/OS: SQLCODE -803 (Db2 for z/OS 13.0.0)
-551Authorization ID lacks the privilege for the operationNegative SQLCODEThe authorization IDs or roles checked were not authorized to perform the named operation on the named object. The object may also be missing or a read-only view.Db2 13 for z/OS: SQLCODE -551 (Db2 for z/OS 13.0.0)
-818Load module and package timestamps differNegative SQLCODEThe precompiler timestamp in the application load module does not match the bind timestamp stored from the DBRM, so the SQL statement cannot run.Db2 13 for z/OS: SQLCODE -818 (Db2 for z/OS 13.0.0)
-532Delete restricted by a referential constraintNegative SQLCODEA DELETE failed because a dependent row exists in a relationship with a RESTRICT or NO ACTION delete rule, directly or through a cascade.Db2 13 for z/OS: SQLCODE -532 (Db2 for z/OS 13.0.0)
-180Datetime value is invalidNegative SQLCODEThe length or string form of a DATE, TIME or TIMESTAMP value does not match any valid format.Db2 13 for z/OS: SQLCODE -180 (Db2 for z/OS 13.0.0)
-302Input variable or parameter invalid or too largeNegative SQLCODEA host variable or parameter value is invalid or too large for the column or target value it is assigned to.Db2 13 for z/OS: SQLCODE -302 (Db2 for z/OS 13.0.0)
-530Foreign key value invalidNegative SQLCODEAn insert or update put a value in a foreign key that does not equal any parent key value in the parent table.Db2 13 for z/OS: SQLCODE -530 (Db2 for z/OS 13.0.0)
-181Datetime string not validNegative SQLCODEThe string form of a datetime value is out of range or in the wrong format. IBM's page lists the allowed ranges.Db2 13 for z/OS: SQLCODE -181 (Db2 for z/OS 13.0.0)
-303Data types not compatible for assignmentNegative SQLCODEA value could not be assigned to an output variable because the variable's data type is not compatible with the source value's type.Db2 13 for z/OS: SQLCODE -303 (Db2 for z/OS 13.0.0)
-923Connection not establishedNegative SQLCODEThe connection to Db2 failed. The message gives a condition, a reason code and the resource involved.Db2 13 for z/OS: SQLCODE -923 (Db2 for z/OS 13.0.0)
+100Row not found or end of dataPositive SQLCODE (informational)No row was found: an empty result, nothing matching an UPDATE or DELETE, or a FETCH past the last row. No data was retrieved, updated or deleted.Db2 13 for z/OS: SQLCODE +100 (Db2 for z/OS 13.0.0)
+304Value does not fit the host variablePositive SQLCODE (warning)A FETCH or SELECT could not return a value because the host variable is too small. Processing continues with a null indicator.Db2 13 for z/OS: SQLCODE +304 (Db2 for z/OS 13.0.0)
+802Arithmetic exception during an operationPositive SQLCODE (warning)An arithmetic operation or built-in function failed on one expression. The indicator is set to -2 and the statement continues.Db2 13 for z/OS: SQLCODE +802 (Db2 for z/OS 13.0.0)
+551Authorization missing for the object or operationPositive SQLCODE (warning)At bind time the authorization ID lacked a privilege, or the object was missing or read-only; the package is still created and the statement is bound at each run.Db2 13 - Codes - SQLCODE +551 | Db2 for z/OS 13.0.0
-204Undefined nameNegative SQLCODEThe object named in the message is not defined in the Db2 subsystem. It can apply to any type of Db2 object.Db2 13 for z/OS: SQLCODE -204 (Db2 for z/OS 13.0.0)
-407Null assigned to a NOT NULL columnNegative SQLCODEA NULL was assigned to a NOT NULL column, or a NOT NULL column without a default was left out of the INSERT or view.Db2 13 - Codes - SQLCODE -407 | Db2 for z/OS 13.0.0
-440No routine found for the name and argumentsNegative SQLCODEDb2 could not resolve a routine call, including its argument list, to an authorized routine definition.Db2 13 - Codes - SQLCODE -440 | Db2 for z/OS 13.0.0
-504Cursor name is not declaredNegative SQLCODEA statement refers to a cursor that has not been declared or allocated, or that was deallocated or is out of scope.Db2 13 - Codes - SQLCODE -504 | Db2 for z/OS 13.0.0
-905Resource limit exceededNegative SQLCODEThe statement was stopped because a resource limit, such as ASUTIME CPU time, was exceeded.Db2 13 - Codes - SQLCODE -905 | Db2 for z/OS 13.0.0
-922Authorization failureNegative SQLCODEAuthorization failed while connecting to Db2; the error type and reason code say which check failed.Db2 13 - Codes - SQLCODE -922 | Db2 for z/OS 13.0.0
-927Language interface called while not connected to Db2Negative SQLCODEA Db2 program was run without the correct execution environment or without the right language interface module.Db2 13 - Codes - SQLCODE -927 | Db2 for z/OS 13.0.0
-104Illegal symbol in SQL statementNegative SQLCODEDb2 hit a symbol it did not expect while reading the SQL statement. The real mistake is often earlier than the symbol it names.Db2 12 for z/OS Codes: -104
-901Unsuccessful execution due to a system errorNegative SQLCODEA system error stopped this one SQL statement from running. Later statements in the same program can still work.Db2 12 for z/OS Codes: -901
-206Name not valid in the context where it is usedNegative SQLCODEA name is used where it is not valid, most often a column that is not in any table or view referenced by the statement.Db2 13 for z/OS: SQLCODE -206 (Db2 for z/OS 13.0.0)
-305Null value fetched with no indicator variable (SQLSTATE 22002)Negative SQLCODEA FETCH, SELECT INTO, VALUES INTO or SET assignment returned NULL for a host variable that has no indicator variable, so the statement fails.Db2 12 for z/OS Codes: -305
-311Host variable length negative or too largeNegative SQLCODEAn input host string variable had a length that was negative or above the allowed maximum, so the statement could not run.Db2 12 for z/OS Codes: -311
-122Column or expression in the select list is not validNegative SQLCODEA select list mixes plain columns or expressions with grouping, but they are not all covered by GROUP BY, so Db2 rejects the statement.Db2 13 for z/OS Codes: -122
-503Column cannot be updated: not in the cursor's FOR UPDATE clauseNegative SQLCODEA positioned UPDATE through a cursor named a column that the cursor's FOR UPDATE clause did not list, so no data was changed.Db2 13 for z/OS Codes: -503
-508Cursor is not positioned on a row that can be updated or deletedNegative SQLCODEUPDATE or DELETE WHERE CURRENT OF ran while the cursor was not on a row of the table, so nothing was changed.Db2 13 for z/OS Codes: -508
-788Same target row identified more than once in a MERGENegative SQLCODEIn a MERGE, one row of the target table matched several rows of the source, so it would be changed more than once and Db2 stops the statement.Db2 13 for z/OS Codes: -788
-811SQLSTATE 21000Negative SQLCODEAn embedded SELECT, a subselect in an UPDATE SET clause, or a basic-predicate subquery returned more than one row or value.Db2 13 - Codes - SQLCODE -811 | Db2 for z/OS 13.0.0
-911SQLSTATE 40001Negative SQLCODEThe unit of work was rolled back after being the victim of a deadlock or a timeout.Db2 13 - Codes - SQLCODE -911 | Db2 for z/OS 13.0.0
-913SQLSTATE 57033Negative SQLCODEThe statement failed because the application was the victim of a deadlock or experienced a timeout.Db2 13 - Codes - SQLCODE -913 | Db2 for z/OS 13.0.0
-904SQLSTATE 57011Negative SQLCODEThe SQL statement failed because a resource it needs was unavailable; the reason code says which and why.-904 (Db2 13 for z/OS)
-501SQLSTATE 24501Negative SQLCODEA FETCH or CLOSE named a cursor that is not open.-501 (Db2 13 for z/OS)
-433SQLSTATE 22001Negative SQLCODEA value had to be cut short by a built-in cast or adjustment function, and truncation is not allowed where that value is used.-433 (Db2 13 for z/OS)
-552SQLSTATE 42502Negative SQLCODEAn authorization ID attempted an operation it has not been granted the authority to perform.-552 (Db2 13 for z/OS)
-30040SQLSTATE 57012Negative SQLCODEA statement or command needed a non-RDB resource that was unavailable; later commands and statements are not affected.-30040 (Db2 13 for z/OS)