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.
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.