ANSI-Compatible Mode Communications Variables - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide

Product
Teradata Preprocessor2
Release Number
17.00
Published
June 2020
Language
English (United States)
Last Update
2020-06-19
dita:mapPath
whb1544831946911.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2446
lifecycle
previous
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 .