Execute a parameterized function
- Execute a noncursor function in the same way as a singleton SELECT
statement.
If you know at the time that you write the program that the dynamic user-defined function always returns just one row, you can use the EXECUTE...USING SQL DESCRIPTOR...INTO statement to provide the argument values from a system-descriptor area and to execute the function.
- Execute a cursor function in the same way as a SELECT statement
that returns one or more rows.
If you are not sure at the time that you write the program that the dynamic user-defined function always returns just one row, define a function cursor and use the OPEN...USING SQL DESCRIPTOR statement to provide the argument values from a system-descriptor area.
The only difference between the execution of these EXECUTE FUNCTION and SELECT statements is that you prepare the EXECUTE FUNCTION statement for the noncursor function, instead of the SELECT statement.