ANSI-Compatible Mode Communications Variables - 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

When writing C programs for ANSI mode, defining a SQLCODE variable is required. Defining a SQLSTATE variable is optional. If both variables are defined, each contains valid error codes.

Do not use the INCLUDE SQLCA construct when writing applications for ANSI mode. Instead, replace that construct with either SQLSTATE or a SQLCODE.

Declare SQLCODE as a 32-bit signed integer. Declare SQLSTATE as a fixed length 6 character array to hold the 5 characterSQLSTATE code plus the null terminator.

Example: Declare Variables for a C Application

EXEC SQL BEGIN DECLARE SECTION;
int  SQLCODE;
char SQLSTATE[6];
EXEC SQL END DECLARE SECTION;

SQLSTATE and SQLCODE are documented in “Result Code Variables” in Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148.