NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
E-8
EXECUTE Statement
[ USING [ ?param=] value [, [?param =] value ] ... ]
[ USING :variable [, :variable ] ... ]
[ USING DESCRIPTOR :in-sqlda ]
specifies values for parameters in the compiled statement. Use the first form in
SQLCI, the second form in a program that has information about the parameters,
and the third form in a program that uses DESCRIBE INPUT to dynamically
retrieve information about the parameters.
Whatever form you use, the following rules apply:
You must supply a value for each parameter in the statement to be executed that
does not currently have a value, including all unnamed parameters.
The data type of a parameter value must be compatible with the data type of the
associated parameter.
Unnamed parameter values are substituted for parameters in the SQL statement
by position. The i-th value in the USING clause or in the SQLDA is the value
for the i-th formal parameter.
Any parameter values you specify in the USING clause override values you
previously specified in SET PARAM commands, but only for this execution of
the statement.
param
(used in SQLCI) is the name of a parameter to be assigned the value that
immediately follows. If you specify the same parameter-value pair more than once,
SQL uses the last specification.
To assign values to unnamed parameters, omit ?param= and specify the values in
the same order that the unnamed parameters appear in the prepared command.
value
(used in SQLCI) is a value for a parameter. A value can be one of the following:
A numeric or string literal, optionally enclosed in quotation marks
CURRENT_TIMESTAMP—an SQLCI function that returns a Julian timestamp
for the current date and time as a value of data type NUMERIC 18 or
LARGEINT.
SQL evaluates CURRENT_TIMESTAMP when the statement in which it
appears executes. As a result, CURRENT_TIMESTAMP in an EXECUTE
statement returns the time that the EXECUTE executes; but
CURRENT_TIMESTAMP in a SET PARAM returns the time that the SET
PARAM executes, not the time that an EXECUTE that uses the parameter
executes.