RETURNS TABLE Clause
The basic RETURNS TABLE clause for a table UDF definition is a basic definition for the table to be returned and consists only of a list of the columns and their respective data types.
The dynamic results row specification RETURNS TABLE clause for a table UDF definition provides a method for dynamically defining the number of columns returned by the function when that number cannot be known before you invoke the function. The only parameter you specify for this clause is the maximum number of output columns. The system defines the column names and data types at run time.