EXECUTE PROCEDURE statement
Use the EXECUTE PROCEDURE statement to invoke a user-defined procedure or a built-in routine. This statement is an extension to the ANSI/ISO standard for SQL.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
function | SPL routine to execute | Must exist | Database Object Name |
output_var | Host variable or program variable that receives the returned value from UDR | In the context of a CREATE TRIGGER statement, must contain column names in the triggering table or in another table | Language specific |
procedure | User-defined procedure to execute | Must exist | Database Object Name |
SPL_var | Variable that contains the name of the SPL routine to execute | Must be a character data type that contains the non-NULL name of an SPL routine. | Identifier |
Usage
The EXECUTE PROCEDURE statement invokes a user-defined procedure and specifies its arguments.
For compatibility with earlier HCL OneDB™ versions, you can use the EXECUTE PROCEDURE statement to execute an SPL function that the CREATE PROCEDURE statement defined.
If the EXECUTE PROCEDURE statement returns more than one row, the result set must be processed within a FOREACH loop of an SPL routine, or else accessed through a cursor of an ESQL/C routine.
In ANSI/ISO-compliant databases that support implicit transactions, the EXECUTE PROCEDURE statement does not, by default, begin a new transaction. SQL statements within the invoked procedure, however, can begin a new transaction.