8. SQL Statements : EXECUTE PROCEDURE : Syntax
 
Share this page                  
Syntax
The EXECUTE PROCEDURE statement has the following formats:
Non-dynamic version:
[EXEC SQL] EXECUTE PROCEDURE [schema.]proc_name
              [([param_name=]param_spec {,[param_name=]param_spec})] |
              [(parm = SESSION.global temporary table_name)]
              [RESULT ROW (variable [:indicator_var]
{, variable[:indicator_var]})]
              [INTO return_status]
              [EXEC SQL BEGIN;program code;
              EXEC SQL END;]
Dynamic version:
[EXEC SQL] EXECUTE PROCEDURE [schema.]proc_name
              [USING [DESCRIPTOR] descriptor_name]
              [INTO return_status]
proc_name
Specifies the name of the procedure, using a literal or a host string variable.
global temporary table_name
Is the name of a global temporary table already declared in the session in which the execute procedure is issued; it must be preceded by the SESSION qualifier.
param_name=
Is the name of the parameter. If using positional parameters, the parameter name is optional. See param_spec next.
param_spec
Is a literal value, a host language variable containing the value to be passed (:hostvar), or a host language variable passed by reference (BYREF(:host_variable)).
If using positional parameters (see Positional Parameters Sample Syntax), each value must correspond to its matching ordinal location in the list of declared parameters.
Note:  Both positional and named parameters can be in a single parameter list, but all positional parameters must precede the first named parameter.