Rahul Sharma (Editor)

DB2 SQL return codes

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

SQL Return Codes are used on a day-to-day basis for the diagnosis of programming failures as a result of SQL calls by DB2 computer programs. An important feature of DB2 programs is the error processing. The error diagnostic containing the SQL Return Code is held in the field SQLCODE within the DB2 SQLCA block.

Contents

SQLCODE is no longer part of the SQL-standard. The SQL-standard replaced SQLCODE by the more detailed SQLSTATE.

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... SQLCA contains ERROR HANDLING data

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 or end of table

Here is a more comprehensive list of the SQLCODEs for DB2:

Zero (Successful)

0 Successful

References

DB2 SQL return codes Wikipedia