SQL Programming Manual for Pascal
Error and Status Processing
HP NonStop SQL Programming Manual for Pascal—528614-001
6-8
Getting Information From the SQLCA
INSERT INTO SALES.PARTS (PARTNUM, PRICE, PARTDESC)
VALUES (:IN_PARTS_REC.IN_PARTNUM,
SETSCALE (:IN_PARTS_REC.IN_PRICE, 2),
:IN_PARTS_REC.IN_PARTDESC) ;
{ End the TMF transaction: }
EXEC SQL COMMIT WORK;
END ; { PERFORM_WORK }
Getting Information From the SQLCA
NonStop SQL returns run-time information, including errors and warnings, for the most
recently executed SQL statement to the SQL communication area (SQLCA). The
SQLCA is the primary status checking area for application programs because it
contains more detailed information than the SQLCODE variable. The compiler
initializes the SQLCA before each executable SQL statement.
Declaring the SQLCA
Use the INCLUDE SQLCA directive to declare the SQLCA in the variable declarations
part of your Pascal program. If the SQLCA must always be accessible to all parts of
your program, include the INCLUDE SQLCA directive with your global variable
declarations. The syntax is:
An example of the INCLUDE SQLCA directive is:
{ Variable declarations: }
EXEC SQL
INCLUDE SQLCA;
...
The INCLUDE SQLCA directive must appear between sections because declarations
added to the program to define the SQLCA begin with the keyword TYPE.
Using System Procedures With the SQLCA
Table 6-2 on page 6-9 shows SQL system procedures you can use to retrieve and
display information from the SQLCA.
INCLUDE SQLCA