SQL Communications Area (SQLCA) | Teradata Vantage - SQL Communications Area (SQLCA) - Teradata Vantage - Analytics Database

SQL Stored Procedures and Embedded SQL

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
frc1628111662093.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
rjx1472253414573
lifecycle
latest
Product Category
Teradata Vantageā„¢

Preprocessor2 can return program status and error information to applications in several possible 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 executed 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 the preprocessor TRANSACT or -tr option is set to ANSI, it 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 one another and to database error messages).

The ANSI/ISO SQL-92 standard explicitly deprecates SQLCODE. The ANSI/ISO SQL-99 standard no longer defines SQLCODE. You should always 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.

To ensure maximum portability, you should always 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 it explicitly in your code. See SQLSTATE, SQLCODE and SQLSTATE Mappings for further information.