Generally, a scalar UDF can appear anywhere a standard SQL scalar function can appear, and an aggregate UDF can appear anywhere a standard SQL aggregate function can appear.
A table function and table operators can only appear in the FROM clause of an SQL SELECT statement. The SELECT statement containing the table function can appear as a subquery.
Required Privileges
You must have the EXECUTE FUNCTION privilege on the UDF or on the database containing the UDF.
For information on how to get these privileges, see SQL Data Control Language.
UDF Arguments
- The arguments must be comma-separated expressions in the same order as the parameters declared in the function.
- The number of arguments passed to the UDF must be the same as the number of parameters declared in the function.
- The data types of the arguments must be compatible with the corresponding parameter declarations in the function and follow the precedence rules that apply to compatible types.
UDF Locations
When calling a UDF, the best practice is to use the fully qualified name of the function, including the containing database. When a function call is qualified by a database name, Teradata Vantage looks first for the UDF in the specified database.
- The path specified by the SET SESSION UDFSEARCHPATH statement, if set.
- Search the default database for a function with the same name and number of parameters as the function call.
- Search the SYSLIB database for a function with the same name and number of parameters as the function call.