SQL Programming Manual for Pascal

NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for Pascal528614-001
3-18
INCLUDE Directives
INCLUDE Directives
The INCLUDE SQLCA, INCLUDE SQLDA, and INCLUDE SQLSA compile-time
directives declare the following data structures:
SQLCA—Stores error and warning information about executable SQL statements
SQLDA—Stores information about input parameters and output variables for
dynamic SQL statements
SQLSA—Stores execution and performance statistics
These directives must be between sections because declarations added to the
program begin with the keyword TYPE.
For detailed information on each directive, see Section 6, Error and Status Processing.
INSERT
The INSERT statement inserts one or more rows into a table or protection view.
In general, specifying an insert operation programmatically in a TAL program is the
same as specifying an insert operation using SQLCI commands.
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 A_TABLE:
EXEC SQL
INSERT INTO A_TABLE
(COLUMN1,
COLUMN2,
COLUMN3,
COLUMN4)
VALUES (:HOSTVAR1,
:HOSTVAR2,
:HOSTVAR3,
:HOSTVAR4)
ANYWHERE ;
The example assumes that the organization of the table is relative. The INSERT
statement supplies values for the four named columns. The system supplies the value
for the system key (SYSKEY). Any other columns in the table receive default values
(either specified defaults or the system default). If any columns are defined as NO
DEFAULT, the insert operation fails because the values were not supplied.
The INSERT statement contains the ANYWHERE clause because the table
organization is relative. ANYWHERE causes the row to be inserted wherever space is
Note. Do not put an INCLUDE directive within a TYPE section. INCLUDE directives generate
text with VAR declarations, and subsequent TYPE declarations cause errors.