Calling a UDF | VantageCloud Lake - Call a UDF - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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

When calling a UDF, the following rules apply to the arguments in the function call:
  • 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.

If you omit the database name, Vantage searches locations to find the UDF using the following order of precedence:
  1. The path specified by the SET SESSION UDFSEARCHPATH statement, if set.
  2. Search the default database for a function with the same name and number of parameters as the function call.
  3. Search the SYSLIB database for a function with the same name and number of parameters as the function call.