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;