Number of Values Returned by SPL, C, and Java Functions
An SPL function can return one or more values. Make sure that the number of returned values matches the number of columns in the table or the number of columns in the column list of the INSERT statement. These columns must have data types that are compatible with the values that the SPL function returns.
An external function written in the C or Java™ language can only return one value. Make sure that you specify only one column in the column list of the INSERT statement. This column must have a compatible data type with the value that the external function returns. The external function can be an iterator function.
The following example shows how to insert data into a temporary
table called result_tmp in order to output to a file the results
of a user-defined function (f_one) that returns multiple rows:
CREATE TEMP TABLE result_tmp( ... );
INSERT INTO result_tmp EXECUTE FUNCTION f_one();
UNLOAD TO 'file' SELECT * FROM foo_tmp;