Parameter Passing Convention - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

UDFs support two types of parameter passing conventions.

Parameter Passing Convention Description Usage
Parameter Style SQL Provides a way to pass nulls as input arguments and return a null as the result.
  • Scalar function
  • Aggregate function
  • Table function
Parameter Style TD_GENERAL Does not accept null input arguments and does not return a null result.
  • Scalar function
  • Aggregate function

The parameter passing convention you use to code a UDF must correspond to the parameter passing specification in the CREATE FUNCTION statement for the UDF.

IF CREATE FUNCTION specifies … AND you are writing … THEN use this syntax for function parameters …
PARAMETER STYLE TD_GENERAL a scalar function Syntax for Scalar Function Parameter Style TD_GENERAL
an aggregate function Syntax for Aggregate Function Parameter Style TD_GENERAL
PARAMETER STYLE SQL or omits the PARAMETER STYLE option a scalar function Syntax for Scalar Function Parameter Style SQL
an aggregate function Syntax for Aggregate Function Parameter Style SQL
a table function Syntax for Table Function

Teradata Database provides a special UDF input parameter data type called the dynamic user-defined type (UDT). UDFs can specify up to eight dynamic UDT input parameters. A dynamic UDT can accommodate up to 128 attributes, where the data types of the attributes are determined at runtime.

If you consider each attribute of a dynamic UDT as an input parameter, then the number of effective input parameters increases to 1144, where:

(8 dynamic UDT parameters * 128 attributes) + (120 parameters of other data types) = 1144

For details on using dynamic UDTs, see Defining Functions that Use UDT Types.