Execute a noncursor function

A noncursor function returns only one row of return values to the application. Use the EXECUTE...INTO DESCRIPTOR statement to execute the function and save the return value or values in an sqlda structure.

An external function that is not explicitly defined as an iterator function returns only a single row of data. Therefore, you can use EXECUTE...INTO DESCRIPTOR to execute most external functions dynamically and save their return values into an sqlda structure. This single row of data consists of only one value because an external function can only return a single value. The sqlda structure contains only one item descriptor with the single return value.

An SPL function whose RETURN statement does not include the WITH RESUME keywords returns only a single row of data. Therefore, you can use EXECUTE...INTO DESCRIPTOR to execute most SPL functions dynamically and save their return values into an sqlda structure. An SPL function can return one or more values at one time so the sqlda structure contains one or more item descriptors.

Important: Because you usually do not know the number of returned rows that a user-defined function returns, you cannot guarantee that only one row is returned. If you do not use a cursor to execute cursor function, Informix® ESQL/C generates a runtime error. Therefore, it is a good practice to always associate a user-defined function with a function cursor.