A table function is invoked in the FROM clause of an SQL SELECT statement and returns a table a row at a time in a loop to the SELECT statement. The function can produce the rows of a table from the input arguments passed to it or by reading an external file or message queue.
Like a method that implements a scalar or aggregate UDF, the parameter list for a method that implements a table UDF includes input parameters that map to the input arguments of the UDF when it is specified in an SQL statement.
Unlike a method that implements a scalar or aggregate UDF, the parameter list of a method that implements a table UDF includes output parameters that map to the columns in the result rows that the table UDF produces. Another difference is that the return type for a method that implements a table UDF is always void.
- 128 input parameters
- As many output parameters as defined by the RETURNS TABLE clause of the CREATE FUNCTION or REPLACE FUNCTION statement for the table function.
The number of output parameters is limited by the maximum number of columns that can be defined for a regular table.