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 precompiler-determined system variables, each of which can be accessed independently. Your application program should never directly alter these variables.

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: Adaptive Server SQLCA variables

Variable

Datatype

Description

sqlcaid

char

Text string that contains “sqlca”.

sqlcabc

long

Length of SQLCA.

sqlcode

long

Contains the return code of the most recently executed SQL statement. See SQLCODE values for return code definitions.

sqlwarn[0] to sqlwarn[7]

char

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.

sqlerrm.sqlerrmc[ ]

char

Error message.

sqlerrm.sqlerrml

long

Error message length.

sqlerrp

char

Procedure that detected error/warning.

sqlerrd[6]

long

Details of error/warning. [2] is the number of rows affected.