Was this helpful?
The Include SQLCA Statement
You must issue the include sqlca statement in front of each compilation unit (subprogram specification, subprogram body, package specification, or package body) containing Embedded SQL statements. You cannot issue the include sqlca statement inside a compilation unit because the statement causes the preprocessor to generate with and use clauses, which are not legal in that context.
exec sql include sqlca;
package Employees is
    procedure Emp_Util_1 is
            -- Declarations for emp_util_1
    begin
            -- Embedded statements for emp_util_1
    end Emp_Util_1;

    procedure Emp_Util_2
            -- Declarations for emp_util_2
    begin
            -- Embedded statements for emp_util_2
    end Emp_Util_2;
end Employees;
The include sqlca statement instructs the preprocessor to generate code that includes references to the SQLCA (SQL Communications Area) record for error handling on database statements. It generates Ada with and use statements referencing a package that defines the SQLCA record variable. The package specification must first be entered in your Ada program library by the procedure described in How to Enter Embedded SQL Package Specifications.
Whether or not you intend to use the SQLCA for error handling, you must issue an include sqlca statement. If you do not issue it, the Ada compiler generates errors about undeclared function names.
Last modified date: 08/14/2024