Use the EXECUTE FUNCTION statement to invoke a user-defined function or a built-in routine that returns a value.

This statement is an extension to the ANSI/ISO standard for SQL.


Element Description Restrictions Syntax
function Name of a user-defined function to execute Must be registered in the database Database Object Name
SPL_var Variable that contains the name of an SPL routine to be executed Must be a CHAR, VARCHAR, NCHAR, or NVARCHAR data type that contains the non-NULL name of an existing SPL function Identifier


The EXECUTE FUNCTION statement invokes a user-defined function (UDF), with arguments, and specifies where the results are to be returned.

An external C or Java™ language function returns exactly one value.

An SPL function can return one or more values.

You cannot use the EXECUTE FUNCTION statement to invoke any type of user-defined procedure that returns no value. Instead, use the EXECUTE PROCEDURE or EXECUTE ROUTINE statement to execute procedures.

You must have the Execute privilege on the user-defined function.

For more information, see GRANT statement.

In ANSI/ISO-compliant databases that support implicit transactions, the EXECUTE FUNCTION statement does not, by default, begin a new transaction. SQL statements within the invoked function, however, can begin a new transaction.