Returning a Varying Column Table External UDF Result
The rules and restrictions are:
The system processes table functions like derived tables.
However, when you reference a table function that outputs a dynamic number of columns, you must specify either an output column list or the name of an existing table as part of the function invocation using the RETURNS … table_name option in the FROM clause of the SELECT request.
IF you specify … |
THEN the system uses the columns … |
an outcome column name list |
specified in the list as the function output columns. |
the name of an existing table |
from the definition for that table as the function output columns. |
In either case, the number of columns specified cannot exceed the defined maximum number of output columns specified by the VARYING COLUMNS maximum_output_columns specification of its CREATE FUNCTION (Table Form) definition.
See “CREATE FUNCTION (Table Form)” in SQL Data Definition Language.
For examples of both forms returning the same result, see “Example 14: Dynamic Row Results Returned by Specifying Table Functions” on page 28.