Opening a Function Cursor

When you open a Function cursor, the EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement is passed to the database server with any values that are specified in the USING clause.

The values in the USING clause are passed as arguments to the user-defined function. This user-defined function must be declared to accept values. (If the statement was previously prepared, the statement was passed to the database server when it was prepared.) The database server executes the function to the point where it returns the first set of values.

The following example illustrates a simple OPEN statement in :
EXEC SQL declare s_curs cursor for
   execute function new_func(arg1,arg2) 
   into :ret_val1, :ret_val2;
EXEC SQL open s_curs;