SQL Programming Manual for Pascal
NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for Pascal—528614-001
3-22
INVOKE
EXEC SQL INSERT INTO T (A)
VALUES (CONVERTTIMESTAMP (:DATE_TIME) );
EXEC SQL COMMIT WORK;
END.
INVOKE
The INVOKE directive declares a view or a table as a type definition that corresponds
one to one with the columns in an SQL table or view. INVOKE writes a Pascal data
description for each column in the table or view. For views only, INVOKE includes the
system-defined primary keys in the definition.
You can use INVOKE to define host variables that you use as input or output variables
for database columns. For more information, see Declaring Host Variables with
INVOKE on page 2-4 in Section 2.
For the best performance, you should use the INVOKE statement to create TYPE
declarations when you have host variables that serve as input or output variables for
database columns. INVOKE declares the types so that no data conversion is required
at run time.
INVOKE Guidelines
•
The INVOKE statement is allowed only in the variable declarations.
•
Logical DEFINEs are allowed for table or view names, but not for record names.
•
The DEFINEs specified in INVOKE are evaluated only when the Pascal program is
compiled. The generated record is not affected by changes to these DEFINEs that
occur after Pascal compilation.
•
To INVOKE a table or view, you must have read authority to the table or view at
Pascal compile time.
•
If you code the INVOKE statement in a Declare Section, the data items described
by the record become host variables, and you can use them in SQL statements.
The compiler checks host variables for naming conflicts with other identifiers
declared in the program.
•
The compiler gives syntax errors for host variable names that are Pascal reserved
words. If conflicts exist, you can use SQLCI to generate the record definition in a
file, change the names that conflict with Pascal reserved words, and copy the
modified record description into your Pascal source program. See the NonStop
SQL Conversational Interface Reference Manual for information about using
INVOKE in a conversational mode.
•
Pascal does not support the SQL type INTEGER UNSIGNED. The compiler
generates comments to this effect for invoked fields of this type. For more
information on types allowed for host variables, see Section 2, Host Variables and
Parameters.