15.10 - SQLCODE Field - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

Preprocessor2 for Embedded SQL
Programming Reference

In particular, the SQLCODE field of the SQLCA contains a negative value when an error condition is reported. If no exception or error condition is encountered during processing, PP2 sets the SQLCODE field to zero.

Some exception conditions, however, are not reflected in the SQLCODE. For example, data truncation on assignment of a value to a host variable or return of a null value are not reported directly. In such cases, the SQLWARN fields or any indicator variables associated with a host variable are set to indicate these conditions.

The application should always check the SQLCODE field upon return from processing an executable statement. Use the WHENEVER statement, as illustrated below, as one method to accomplish SQLCODE checking. For details on the SQLCA fields, see SQL Stored Procedures and Embedded SQL (B035‑1148).