PreviousSQL Engine Reference (v10) Next

EXECUTE

Chapter contents

The EXECUTE statement has two uses:

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


Chapter contents
Book contents

Prev topic: END
Next topic: EXISTS