Execute a parameterized function

You handle the input parameters of a user-defined function in the same way that you handle input parameters in the WHERE clause of a SELECT statement, as follows:
  • 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 DESCRIPTOR...INTO statement to provide the argument values from an sqlda structure and to execute the function. For more information, see Execute a parameterized singleton SELECT statement.

  • 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 DESCRIPTOR statement to provide the argument values from an sqlda structure. For more information, see Execute a parameterized SELECT that returns multiple rows.

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.