15.10 - VARYING COLUMNS (maximum_output_columns) - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

Number of output columns to be returned by the function is not known before it is invoked, so limit them to a maximum of maximum_output_columns columns.

The upper limit is 2,048 columns per table function.

There is no default value.

Example: Dynamic Result Row Specification

The following example defines a table function named extract_store_data that has variable output columns.

The SELECT request following the function definition uses extract_store_data to parse the input text string and extract store sales data into the store_data table.

     CREATE FUNCTION extract_store_data (
       text       VARCHAR(32000),
       from_store INTEGER)
     RETURNS TABLE VARYING COLUMNS (10)
     SPECIFIC extract_store_data
     LANGUAGE C
     NO SQL
     PARAMETER STYLE SQL
     NOT DETERMINISTIC
     EXTERNAL NAME 'SS!extract_store_data!extract_store_data.c';
     INSERT INTO store_data
     SELECT * 
     FROM (TABLE(extract_store_data('…', 1000) 
     RETURNS store_data) AS store_sales;