SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
E-9
Considerations—EXECUTE
RETURNING { :variable }
{ USING DESCRIPTOR :out-sqlda }
(used only if a dynamic INSERT RETURNING is executed) directs SQL to return
the SYSKEY for the last record inserted.
:variable is a host variable in which to return the key. It must be of an
appropriate type for the key (INTEGER UNSIGNED for tables with
entry-sequenced or relative organization; LARGEINT SIGNED for tables with
key-sequenced organization).
:out-sqlda is an SQLDA set by the DESCRIBE statement that tells where to
return the key. If you use this option, your program must have set the VAR_PTR
field in the SQLDA to point to a buffer to receive the SYSKEY value.
If you use the RETURNING clause for a table with a clustering key, SQL returns
only the appended SYSKEY. To find the record, specify the clustering key columns
and the SYSKEY column (the most efficient method), or only the SYSKEY column.
Considerations—EXECUTE
A statement must be compiled by PREPARE before you can EXECUTE it but after
it is compiled, you can EXECUTE the statement multiple times without recompiling
it.
Host language scoping rules apply to EXECUTE in programs. For more
information, see the SQL/MP programming manual for the host language you use.
You must supply a value for each formal parameter in the statement to be
executed, and each value must be of a type compatible with the associated formal
parameter.
You can specify parameter values for named formal parameters with the USING
clause, with the SQLCI SET PARAM command, or with the TACL PARAM
command. (A TACL PARAM named “A” is the same as a parameter named “?A” in
SQLCI.) You can specify parameter values for unnamed parameters only with the
USING clause.
Unless a CONTROL QUERY BIND NAMES AT EXECUTION directive is in effect
when a PREPARE executes, the compiled statement uses the defaults and
DEFINEs in effect at the time it is prepared, not the time it executes. For
information, see CONTROL QUERY Directive on page C-74 or Name Resolution
on page N-2.
You cannot execute a prepared DDL statement (except UPDATE STATISTICS)
that operates on nonaudited tables or indexes within a user-defined TMF
transaction.