SQLCODE Variable - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Teradata Preprocessor2
Release Number
20.00
Published
October 2023
ft:locale
en-US
ft:lastEdition
2023-11-20
dita:mapPath
nyr1691484085721.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
xfi1470440464166
Product Category
Teradata Tools and Utilities

SQLCODE contains a negative value when an error condition is reported. A positive value indicates that a warning has occurred.

If no exception or error condition is encountered during processing, PP2 sets SQLCODE to zero.

SQLCODE is defined as a long integer variable:

DCL SQLCODE FIXED BIN(31);

Some exception conditions are not reflected in SQLCODE. Data truncation on assignment of a value to a host variable is returned in SQLCODE(+902). In these cases, the SQLWARN fields or any indicator variables associated with a host variable are set to indicate these conditions.

The application must always check the SQLCODE variable upon return from processing an executable statement. Use the WHENEVER statement as one method to accomplish SQLCODE checking.

A SQLCODE and a SQLSTATE variable can be defined for the same compilation unit. Both contain valid result codes.

For more information on the ANSI SQLCODE variable, see Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148.