SQLCA variables

When the precompiler encounters the include sqlca statement, it inserts the SQLCA structure declaration into the application program. SQLCA is a data structure containing 26 precompiler-determined system variables, each of which can be accessed independently.

SQLCA variables pass information to your application program about the status of the most recently executed Embedded SQL statement.

Table 3-1 describes the SQLCA variables that hold status information, return codes, error codes, and error messages generated by Adaptive Server:

Table 3-1: ASE SQLCA variables

Variable

Datatype

Description

SQLCAID

PIC X(8)

Text string that contains “SQLCA”.

SQLCABC

PIC S9(9) COMP

Length of SQLCA.

SQLCODE

PIC S9(9) COMP

Contains the return code of the most recently executed SQL statement. See the SQLCODE values in Table 3-2 for return code definitions.

SQLWARN0 to SQLWARN7

PIC X(1)

Warning flags. Each flag indicates whether a warning has been issued: a “W” for warning, or a blank space for no warning. Chapter 8 describes the SQLWARN flags.

SQLERRMC

PIC X(256)

Error message.

SQLERRML

PIC S9(9) COMP

Error message length.

SQLERRP

PIC X(8)

Procedure that detected error/warning.

SQLERRD

PIC S9(9) COMP OCCURS 6 TIMES

Details of error/warning. SQLERRD(3) is number of rows affected.