Error Processing
An important feature of DB2 computer programs is error handling. The SQL communications area (SQLCA) structure was once used exclusively within a DB2 program to return error information to the application program after every SQL statement was executed. The primary, but not singularly useful, error diagnostic is held in the field SQLCODE within the SQLCA block.
The SQL return code values are:
- 0 means successful execution.
- A positive number means successful execution with one or more warnings. An example is
+100, which means no rows found. - A negative number means unsuccessful with an error. An example is
-911, which means a lock timeout (or deadlock) has occurred, triggering a rollback.
Later versions of DB2 added functionality and complexity to the execution of SQL. Multiple errors or warnings could be returned by the execution of an SQL statement; it may, for example, have initiated a Database Trigger and other SQL statements. Instead of the original SQLCA, error information should now be retrieved by successive executions of a GET DIAGNOSTICS statement.
See SQL return codes for a more comprehensive list of common SQLCODEs.
Read more about this topic: IBM DB2
Famous quotes containing the word error:
“They have their belief, these poor Tibet people, that Providence sends down always an Incarnation of Himself into every generation. At bottom some belief in a kind of pope! At bottom still better, a belief that there is a Greatest Man; that he is discoverable; that, once discovered, we ought to treat him with an obedience which knows no bounds. This is the truth of Grand Lamaism; the discoverability is the only error here.”
—Thomas Carlyle (17951881)