SQL Communications Area (SQLCA) | VantageCloud Lake - SQL Communications Area (SQLCA) - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Preprocessor2 can return program status and error information to applications in multiple ways.

The primary communication method for applications written to run in Teradata session mode has been the SQLCA structure. SQLCA is a data structure that contains a list of return codes and other status information about a completed DML statement.

SQLCA provides the following support to embedded SQL applications:
  • Result reporting
  • Warning condition reporting
  • Support for DSNTIAR

Embedded SQL application programs can interrogate the fields of SQLCA for the return codes that indicate the results of having run an embedded SQL statement.

Embedded SQL applications can also retrieve full diagnostic text by using a supplied routine (see PPRTEXT).

SQLCA cannot be used with stored procedures.

ANSI Compliance

The SQL Communications Area and the INCLUDE SQLCA statement are not ANSI-SQL compliant. When set to ANSI, the preprocessor TRANSACT or -tr option flags INCLUDE SQLCA as an error.

ANSI mode applications report program status and errors by means of the SQLSTATE and SQLCODE status variables (see SQLSTATE Mappings for information about mapping SQLCODE and SQLSTATE variables to each other and to database error messages).

The ANSI/ISO SQL-92 standard explicitly deprecates SQLCODE. The ANSI/ISO SQL-99 standard no longer defines SQLCODE. Use SQLSTATE when writing stored procedures and embedded SQL applications to run in ANSI transaction mode. You can also use SQLSTATE in your stored procedures and embedded SQL applications written to run in Teradata transaction mode.

For maximum portability, use SQLSTATE, not SQLCODE, to monitor application status.

When you are developing stored procedures or embedded SQL applications in the ANSI environment, use the status variable SQLSTATE in place of SQLCA and define SQLSTATE explicitly in your code. See SQLSTATE Result Code Variable, SQLCODE Result Code Variable and SQLSTATE Mappings for further information.