SQL defines a set of status parameters that can be part of the
parameter list for a procedure definition in a nonstored module.
They are SQLSTATE, SQLCODE, and SQLCA. An SQL procedure is
required to contain at least one of these status parameters in
its parameter list. All status parameters are implicitly output
parameters.
The purpose of these status parameters is to return the status of
each SQL statement that is executed. Each status parameter gives
information that allows you to determine whether the statement
completed execution or an exception has occurred. These status
parameters differ in the amount of diagnostic information they
supply, when an exception occurs as follows:
o SQLCODE-This is the original SQL error handling mechanism.
It is an integer value. SQLCODE differentiates among errors
(negative numbers), warnings (positive numbers), successful
completion (0), and a special code of 100, which means no
data. SQLCODE is a deprecated feature of the ANSI/ISO SQL
standard.
o SQLCA-This is an extension of the SQLCODE error handling
mechanism. It contains other context information that
supplements the SQLCODE value. SQLCA is not part of the
ANSI/ISO SQL standard. However, many databases such as DB2
and ORACLE RDBMS have defined proprietary semantics and syntax
to implement it.
o SQLSTATE-This is the error handling mechanism for the ANSI/ISO
SQL standard. The SQLSTATE value is a character string that is
associated with diagnostic information.
See the Oracle Rdb SQL Reference Manual for more detailed
information.