EXECUTE FUNCTION statement

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.

Syntax

(explicit id exfu002) exfu002 (explicit id exfu003) exfu003 (explicit id exfu011) exfu011 (explicit id exfu012) exfu012 (explicit id exfu007) exfu007 (explicit id exfu008) exfu008 EXECUTE FUNCTION { { function | []SPL_var } ( [ <Argument>[] ] ) [][] <INTO Clause>[] } [ [] WITH TRIGGER REFERENCES[] ]
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

Usage

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.

1 Stored Procedure Language only
2 ESQL/C only
3 Trigger functions only