SQL Codes
SQL Codes
SQLCA
The SQL communications area (SQLCA) structure is used within the DB2 program to return error information to the application program. This information in the SQLCA and the SQLCODE field is updated after every API call for the SQL statement...
SQLCODE
The SQLCODE field contains the SQL return code. The code can be zero (0), negative or positive. 0 means successful execution. Negative means unsuccessful with an error. An example is -911 which means a timeout has occurred with a rollback. Positive means successful execution with a warning. An example is +100 which means no rows found. Here is a more comprehensive list of the SQLCODEs for DB2:
Zero (Successful)
0 Successful
-101 The statement is too long or too complex. -102 -117 -180 -181 -199 String constant is too long. The number of values in the INSERT does not match the number of columns. Bad data in Date/Time/Timestamp. Bad data in Date/Time/Timestamp. Illegal use of the specified keyword.
Object not defined to DB2. Column name not in table. Column does not exist in any table of the SELECT. Not the same number of expressions on both sides of the comparison in a SELECT . FETCH cannot make an INSENSITIVE cursor SENSITIVE.
Null indicator needed. Varchar, insert or update. -LEN field with the right data length not set. AN UPDATE, INSERT, OR SET VALUE IS NULL, BUT THE OBJECT COLUMN column-name CANNOT CONTAIN NULL VALUES The procedure returned no locators.
Cursor not open on FETCH. Opening cursor that is already open. Updating column needs to be specified. Referential integrity preventing the INSERT/UPDATE Referential integrity (DELETE RESTRICT rule) preventing the DELETE. Referential integrity (DELETE RESTRICT rule) preventing the DELETE. Check constraint preventing the INSERT/UPDATE. Authorization failure.
Too many columns specified in a create index. The table is not available. Duplicate key on insert or update. DBRM or package not found in plan. More than one row retrieved in SELECT INTO. Plan and program: timestamp mismatch.
-904 Unavailable resource. Someone else is locking your data. -911 Deadlock or timeout. Rollback has been done. -913 Deadlock or timeout. No rollback. -922 Authorization needed. -927 The language interface was called but no connection had been made. -936 -1741 -20000 -30090 Remote operation invalid for application execution environment.
References
"DB2 Version 9.1 for z/OS Codes" [1]. June 2010. "Tutorial on SQLCODES and Their Causes" [2]. July 2011.
References
[1] http:/ / publib. boulder. ibm. com/ infocenter/ dzichelp/ v2r2/ topic/ com. ibm. db29. doc. codes/ dsnc1k17. pdf?noframes=true [2] http:/ / theamericanprogrammer. com/ programming/ sqlcodes. shtml
License
Creative Commons Attribution-Share Alike 3.0 Unported //creativecommons.org/licenses/by-sa/3.0/