Where do you find sql return codes?
- SQL Return Code is held in the field SQLCODE within the DB2 SQLCA block.
- The SQL-standard replaced SQLCODE by the more detailed SQLSTATE.
The SQL communications area (SQLCA) structure is used within the DB2 program to return a feedback to the application program. The information in the SQLCA and the SQLCODE field are updated after every API call with a SQL statement. SQLCA contains ERROR HANDLING data.
The SQLCODE field contains the SQL return code. The code can be zero (0), negative or positive:
0 means that the execution was successful.
Negative values incidate an unsuccessful execution with an error.
Positive value mean a successful execution with a warning.
SQLCODES -904, -911, -913, -922, -924
- -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.
- -924 DB2 Connection internal error.
SQLCODES 0, +100, -811, -30090
- 0 = SUCCESSFUL
- +100 Row not found or end of cursor.
- -811 = More than one row retrieved in SELECT INTO.
- -30090 Remote operation invalid for application execution environment.
+100 Row not found or end of cursor.