SQL Programming Manual for TAL

Host Variables and Parameters
HP NonStop SQL Programming Manual for TAL527887-001
2-7
Using Host Variables
variable. The syntax for using a host variable in an SQL statement is shown below.
For a complete description of this syntax, see the SQL/MP Reference Manual.
:host-identifier
is a TAL data item. Use :host-identifier in DML statements where a literal can be
used (except in the INVOKE and INCLUDE directives).
INDICATOR
is a keyword that allows for:
Handling null values that might be returned to the host variable
Inserting null values into the database through the host variable
:indicator-host-identifier
is an indicator variable with type INT. For values returned to a host variable,
: indicator-host-identifier is:
-1 if the value is null
0 if the value is not null
To insert t null values into the database, set : indicator-host-identifier to a value less
than zero.
TYPE AS
directs NonStop SQL to treat the variable as a date-time (DATETIME, DATE, TIME,
or TIMESTAMP) or INTERVAL value. To direct NonStop SQL to treat the host
variable as a scaled value, either define the variable as TAL data type FIXED or
use the SETSCALE function, which is described under Using Scaled Numeric Data
Items as Host Variables on page 2-12.
:host-identifier[[ INDICATOR ]: indicator-host-identifier ]
[ TYPE AS {DATETIME [start-date-time TO] end-date-time } ]
[ { } ]
[ {DATE } ]
[ { } ]
[ {TIME } ]
[ { } ]
[ {TIMESTAMP } ]
[ { } ]
[ {INTERVAL start-date-time } ]
[ { [ ( start-field-precision ) ] } ]
[ { [ TO end-date-time ] } ]