SQL Programming Manual for Pascal

Host Variables and Parameters
HP NonStop SQL Programming Manual for Pascal528614-001
2-6
Using Host Variables
e_dt_time : fstring(7);
end;
Using Host Variables
After you declare a host variable, you can use the variable in an SQL statement just as
you would in a Pascal statement, except that you must precede the host variable name
with a colon (:). The colon causes the Pascal compiler to treat the name as a host
variable.
If the host variable contains a date-time or INTERVAL value, include the TYPE AS
clause when you use the variable. If the host variable can contain a null value, you
must also include the INDICATOR clause.
The syntax for using a host variable in an SQL statement follows. For a complete
description of the syntax, see the SQL/MP Reference Manual.
: record-name
specifies the name of the record that contains the host variable. If a host variable
appears in a record, the name of the host variable must always be fully qualified
with the record name and any nested record names.
: host-identifier
specifies the name of the host variable as declared in the program.
INDICATOR
is a keyword for handling null values that might be returned to the host variable or
for inserting null values into the database through the host variable.
For handling values returned to the host variable, the program checks the value of
indicator-host-variable. If the value returned to the host variable from the database
is a null value, then the indicator host variable is set to -1. If the value returned is
not a null value, then the indicator host variable is set to 0.
:[ record-name. ] host-identifier
[[ INDICATOR ]: indicator-host-variable ]
[ TYPE AS { DATETIME [ start-date-time TO] end-date-time } ]
[ { } ]
[ { DATE } ]
[ { } ]
[ { TIME } ]
[ { } ]
[ { TIMESTAMP } ]
[ { } ]
[ { INTERVAL start-date-time } ]
[ { [ ( start-field-precision ) ] } ]
[ { [ TO end-date-time ] } ]