Was this helpful?
EXECUTE PROCEDURE
Valid in: SQL, ESQL, DBProc, OpenAPI, ODBC, JDBC, .NET
The EXECUTE PROCEDURE statement invokes a database procedure.
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})] |
              [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.
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)).
The EXECUTE PROCEDURE statement executes a specified database procedure.
Database procedures can be executed from interactive SQL (the Terminal Monitor), an embedded SQL program, or from another database procedure.
This statement can be executed dynamically or non-dynamically. When executing a database procedure, you typically provide values for the formal parameters specified in the definition of the procedure.
If an EXECUTE PROCEDURE statement includes a RESULT ROW clause, it can only be executed non-dynamically.
Last modified date: 08/14/2024