Use the CALL statement to execute a user-defined routine (UDR) from within an SPL routine.


Element Description Restrictions Syntax
data_var Variable to receive the values function returns The data type of data_var must be appropriate for the returned value Identifier
function, procedure User-defined function or procedure The function or procedure must exist Identifier
routine_var Variable that contains the name of a UDR Must be a character data type that contains the non-NULL name of an existing UDR Identifier


The CALL statement invokes a UDR. The CALL statement is identical in behavior to the EXECUTE PROCEDURE and EXECUTE FUNCTION statements, but you can only use CALL from within an SPL routine.

You can use CALL in programs or with DB-Access, but only if the statement is in an SPL routine that the program or DB-Access executes.

When you use CALL to invoke a user-defined function that you specify by its function identifier or as a routine_var that stores the identifier of the function, the CALL statement must also include the RETURNING clause.

The CALL statement cannot invoke an iterator TABLE function from a subquery in the FROM clause of a SELECT statement. For the syntax of iterator TABLE functions, see Iterator Functions.