16.20 - Dynamic Result Row Specification - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

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 output parameters in the Java method 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 output parameters that the method 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 JAVA
NO SQL
EXTERNAL NAME 'JarUDF:UDFExample.getStoreData'
PARAMETER STYLE JAVA;

In this example, the number of output parameters in the table UDF parameter list is 10.