SQL Programming Manual for TAL
Host Variables and Parameters
HP NonStop SQL Programming Manual for TAL—527887-001
2-23
Parameters
Your program can now read the values stored in the columns of the SQL table into the
host variables. For example:
EXEC SQL SELECT typestbl.a_char, typestbl.a_dbl
INTO :tbl.a^char, :tbl.a^dbl;
Parameters
A parameter is a place holder variable in an SQL statement that enables you to specify
run-time input in a dynamic SQL statement. You compile the SQL statement without
the input values and then supply the values when the statement is executed. The
syntax for a parameter is shown below. For a complete description of the parameter
syntax elements, see the SQL/MP Reference Manual.
identifier
is an SQL identifier that is the name of the parameter. Follow these guidelines when
you declare and use parameter names:
•
You cannot qualify a parameter name.
•
An unnamed parameter, which is a question mark (?) by itself, is always a distinct
parameter even with multiple occurrences in a statement.
•
You can use a parameter name in any SQL statement (except a DDL statement)
where a numeric or string literal is allowed.
indicator-parameter
is the indicator parameter name. The indicator parameter has the same format as
the parameter name with which it is associated. You use an indicator parameter to
handle null values that might be returned to the parameter or to insert null values
into a database through the parameter.
For handling a null value returned to the parameter, the value of identifier can be –
1 if the value is null or 0 if the value is not null. For inserting a value into a
database, set indicator-param to –1 (null) or 0 (not null) before executing the
INSERT or UPDATE statement.
?[ identifier] [ [ INDICATOR ] ?[indicator-parameter] ]
[ TYPE AS {DATETIME [ start-date-time TO] end-date-time} ]
[ { } ]
[ {DATE } ]
[ { } ]
[ {TIME } ]
[ { } ]
[ {TIMESTAMP } ]
[ { } ]
[ {INTERVAL start-date-time } ]
[ { [ ( start-field-precision ) ] } ]
[ { [ TO end-date-time ] } ]










