Was this helpful?
Contents of the SQLCA
One of the results of issuing the include sqlca statement is the declaration of the SQLCA structure, which you can use for error handling in the context of database statements. The record declaration for the SQLCA is:
type IISQL_ERRM is       -- Varying length string.
        record
                sqlerrml: Short_Integer;
                sqlerrmc: String(1..70);
        end record;

type IISQL_ERRD is array(1..6) of Integer;

type IISQL_WARN is       -- Warning structure.
        record
                sqlwarn0: Character;
                sqlwarn1: Character;
                sqlwarn2: Character;
                sqlwarn3: Character;
                sqlwarn4: Character;
                sqlwarn5: Character;
                sqlwarn6: Character;
                sqlwarn7: Character;
        end record;

type IISQLCA is
        record
                sqlcaid: String(1..8);
                sqlcabc: Integer;
                sqlcode: Integer;
                sqlerrm: IISQL_ERRM;
                sqlerrp: String(1..8);
                sqlerrd: IISQL_ERRD;
                sqlwarn: IISQL_WARN;
                sqlext:  String(1..8);
        end record;

sqlca: IISQLCA;
The nested record sqlerrm is a varying length character string consisting of the two variables sqlerrml and sqlerrmc described in the SQL Reference Guide. For a full description of all the SQLCA structure members, see the SQL Reference Guide.
The SQLCA is initialized at load-time. The sqlcaid and sqlcabc fields are initialized to the string "SQLCA" and the constant 136, respectively.
Note that the preprocessor is not aware of the record declaration. Therefore, you cannot use members of the record in an Embedded SQL statement. For example, the following statement, attempting to insert the string "SQLCA" into a table generates an error:
exec sql insert into
        employee (ename) -- This statement is illegal
        values (:sqlca.sqlcaid);
All modules written in Ada and other Embedded SQL languages share the same SQLCA.
Last modified date: 04/03/2024