ALLBASE/SQL Reference Manual (36216-90216)

Chapter 11 417
SQL Statements E - R
EXECUTE
IndicatorVariable
names an indicator variable, whose value determines whether the
associated host variable contains a NULL value:
> = 0 the value is not NULL
< 0 the value is NULL
Description
There must be a one to one mapping of the input and/or output parameters in a
prepared statement and its associated EXECUTE statement.
INPUT is the default for any EXECUTE statement and can be specified, as required, for
any type of prepared statement.
The OUTPUT clause is only allowed when the prepared statement is an EXECUTE
PROCEDURE statement containing output dynamic parameters.
An INPUT AND OUTPUT clause is only allowed when the prepared statement is an
EXECUTE PROCEDURE statement containing both input and output dynamic
parameters.
•If
StatementName
is an EXECUTE PROCEDURE statement without any input and
output dynamic parameters, you can execute the procedure by issuing EXECUTE
StatementName
.
•If
StatementName
is an EXECUTE PROCEDURE statement with either input or output
dynamic parameters, you can use the EXECUTE USING statement with INPUT (default)
or OUTPUT option to execute the dynamically preprocessed statement.
•If
StatementName
is an EXECUTE PROCEDURE statement with both input and output
dynamic parameters, you can use the EXECUTE USING statement with the INPUT AND
OUTPUT option to execute the dynamically preprocessed statement.
Use the USING clause for either an SQLDA DESCRIPTOR or a
HostVariableSpecification
for input and/or output dynamic parameter
substitution in a prepared statement.
The :
Buffer
[,:
StartIndex
[, :
NumberOfRows
option is only used in association with a
BULK INSERT statement.
•If
StatementName
is an EXECUTE PROCEDURE statement, and there are multiple row
result sets from the procedure, you must use the procedure cursor method to retrieve
result sets. A warning is returned if a procedure cursor is not used in this case; the
return status and output parameters are returned as usual.
Authorization
In an application program, the EXECUTE statement does not require any special
authorization. The user running the program must have whatever authorization is
required by the dynamically preprocessed statement being executed.
To use the EXECUTE statement in the interactive environment, you must have RUN or
OWNER authority for the dynamically preprocessed statement or have DBA authority. In
addition, the owner of the dynamically preprocessed statement must have whatever