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. |
|
Parameter Style TD_GENERAL | Does not accept null input arguments and does not return a null result. |
|
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.
PARAMETER STYLE | Function | Function Parameter Syntax |
---|---|---|
TD_GENERAL | Scalar | Scalar Function Parameter Style TD_GENERAL Syntax |
Aggregate | Aggregate Function Parameter Style TD_GENERAL Syntax | |
SQL or omitted | Scalar | Scalar Function Parameter Style SQL Syntax |
Aggregate | Aggregate Function Parameter Style SQL Syntax | |
Table | Table Function Syntax |
Teradata 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.