Methods of Executing Procedures
Database procedures can be executed in the following ways:
• By using the EXECUTE PROCEDURE statement in an embedded SQL application.
This statement executes a specified procedure and passes parameter values to the procedure. To specify different parameter lists at runtime, use the dynamic version of the EXECUTE PROCEDURE statement. To execute a procedure owned by a user other than the effective user of the session, specify the procedure name using the schema.procedure_name syntax.
• When a rule is fired.
Indirectly executed procedures must handle errors and messages differently than directly executed procedures. A procedure that is executed as the result of a rule can execute statements that trigger other rules, and so on. For information about using database procedures with rules, see
Rules (see
Rules).
Note: This method cannot execute row-producing procedures.
• From interactive SQL, from within another database procedure, or by using the dynamic SQL EXECUTE IMMEDIATE statement.
Note: These methods cannot execute row-producing procedures.
A procedure cannot be executed using the dynamic SQL PREPARE and EXECUTE statements.
• By using the OpenAPI IIapi_query() function.
For details about executing a database procedure, see Execute Procedure in the chapter “SQL Statements.”
All referenced objects must exist at the time the procedure is executed. Between the time of creation and the time of execution, objects such as tables and columns can be modified, reordered, or dropped and recreated without affecting the procedure definition. However, if an object is redefined in a way that invalidates the procedure definition, drop and recreate the procedure.