Dynamic Result Row Specification - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

If the CREATE FUNCTION or REPLACE FUNCTION statement specifies a RETURNS TABLE VARYING COLUMNS clause, then the table function is said to have a dynamic result row specification. The number of result parameters in the table function parameter list matches the maximum number of columns in the RETURNS TABLE VARYING COLUMNS clause of the CREATE FUNCTION or REPLACE FUNCTION statement.

The actual number and data types of the result parameters that the table function needs to return values in is specified dynamically at runtime in the SELECT statement that invokes the table function.

Here is an example of a CREATE FUNCTION statement for a table function with a dynamic result row specification:

CREATE FUNCTION getStoreData
  (FileToRead INTEGER)
RETURNS TABLE VARYING COLUMNS (10)
LANGUAGE C
NO SQL
EXTERNAL NAME 'CS!getdata!udfsrc/gs2.c'
PARAMETER STYLE SQL;

In this example, the number of result parameters in the table function parameter list is 10.