SQL Programming Manual for TAL

NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for TAL527887-001
3-19
INCLUDE SQLCA, INCLUDE SQLDA, and
INCLUDE SQLSA
For a dynamic SQL cursor, all statements referring to the cursor must appear in the
procedure where the cursor is declared; however, if you open the cursor and use it in
one call to the procedure where it is declared, you can still use the cursor in
subsequent calls without opening the cursor again.
INCLUDE SQLCA, INCLUDE SQLDA, and INCLUDE SQLSA
The INCLUDE SQLCA, INCLUDE SQLDA, and INCLUDE SQLSA directives declare
the following data structures:
INCLUDE SQLCA
Declares the SQL communications area (SQLCA), which contains run-time
information including errors and warnings generated by the most recently executed
SQL statement
INCLUDE SQLDA
Declares the SQL descriptor area (SQLDA), which contains run-time information
about input parameters and output variables in dynamic SQL statements
INCLUDE SQLSA
Declares the SQL statistics area (SQLSA), which contains run-time information
about the statistics and performance of SQL statements
For more information on the description of each directive, see Section 6, Error and
Status Processing.
INSERT
The INSERT statement inserts one or more rows into a table or protection view.
To execute an INSERT statement, a program's process accessor ID (PAID) must have
read and write access to the table or view receiving the data and read access to tables
and views if you use a SELECT statement parameter.
In general, specifying an insert operation programmatically in a TAL program is the
same as specifying an insert operation using SQLCI commands. With SQLCI, you
specify the new values in an INSERT statement, while in a program, you set one or
more host variables to the new values and then use the host variables in the INSERT
statement.
In a program, you move the row data to a series of host variables and then use an
INSERT statement that specifies these host variables to write the row to the table. For
example, the following statement inserts a row into the table named TABLE1: