SQL Programming Manual for TAL

HP NonStop SQL Programming Manual for TAL527887-001
2-1
2 Host Variables and Parameters
This section describes the data items that you use to provide for communication
between TAL and SQL statements in a TAL program.
Host Variables
A host variable is a data item you can use in both TAL and SQL statements to provide
for communication between the two types of statements.
For static SQL operations, a host variable can be an input or output variable (or both in
some cases) in SQL statements. An input variable transfers data from the program to
the database, while an output variable transfers data from the database to the
program. (For dynamic SQL operations, input parameters and output variables fulfill
the same function as input and output host variables in static SQL statements.)
A host variable can be a:
Simple variable
Whole STRING array (SQL type DECIMAL or CHAR)
Element in an array
Indirect array or structure (including standard and extended indirection)
Structure that conforms to SQL data type VARCHAR
Field in a structure
SQLDA structure
However, a host variable cannot be a:
Constant
TAL DEFINE identifier
Variable of TAL data type UNSIGNED
Pointer
TAL array of type other than STRING
Structure except VARCHAR and SQLDA structures
A host variable can be any TAL data item that has a corresponding SQL data type as
shown in Tabl e 2-1 on page 2-3. NonStop SQL must be able to convert the data
between the two data types. If your program returns a TAL assignment expression to a
host variable, the TAL compiler must be able to convert the value of the expression to
the data type of the host variable.