EXECUTE
The EXECUTE statement has two uses:
•
To invoke a user-defined procedure or a system stored procedure. You may use EXECUTE in place of the
CALL
statement
•
To execute a character string, or an expression that returns a character string, within a stored procedure.
Syntax
To invoke a stored procedure:
EXEC[UTE
]
stored-procedure
[ ( [
procedure-parameter
[ ,
procedure-parameter
]... ] ) ]
stored-procedure
::= the name of a stored procedure
procedure-parameter
::= the input parameter(s) required by the stored procedure
Within a user-defined stored procedure:
EXEC[UTE]
(
string
[ +
string
]... )
string
::= a string, string variable, or an expression that returns a character string
Examples
The following example executes a procedure without parameters:
EXEC NoParms() or CALL NoParms
The following examples execute a procedure with parameters:
EXEC Parms(vParm1, vParm2)
EXECUTE CheckMax(N.Class_ID)
============
The following procedure selects the student ID from the Billing table.
CREATE PROCEDURE tmpProc(IN :vTable CHAR(25)) RETURNS (sID INTEGER) AS
BEGIN
EXEC ('SELECT Student_ID FROM ' + :vtable);
END;
EXECUTE tmpProc(‘Billing’)
See Also
CALL
CREATE PROCEDURE
System Stored Procedures