16.20 - Function Calling Argument - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Detailed Topics

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1184-162K
Language
English (United States)

The function calling argument is any simple SQL expression, including, but not limited to, constant values, column references, host variables, the NEW VARIANT_TYPE UDT constructor expression (see Teradata Vantage™ SQL Operators and User-Defined Functions, B035-1210), or an expression containing any of these, including expressions containing UDFs.

You cannot call a Teradata Row-Level Security policy function from a DML request. Teradata Row-Level Security policy functions can only be specified with column definitions in a CREATE TABLE or ALTER TABLE request.

When you call a function, and that function is not stored in either your default database or in database SYSLIB, you must fully qualify the function call with a database name. If your default database and SYSLIB both contain functions matching the name of the called function, then the system references the UDF in your default database. This is the only exception that requires an explicit qualification for SYSLIB.

The argument types passed in the call must be compatible with the parameter declarations in the function definition of an existing function. If there are several functions that have the same name, and no qualifying database is specified, then the particular function that is picked is determined by the following process:

  1. The system searches the list of built-in functions.

    If the called function has the same name as a Teradata Database built-in function, the search stops and that function is used.

    If a candidate function is not found, proceed to stage 2.

  2. The system searches the list of function names in the default user database.

    Candidate functions are those having the same name and number of parameters as specified by the function call as well as the best fit based on their parameter type.

    If a candidate function is not found, proceed to stage 3.

  3. The system searches the list of function names in the SYSLIB database.

    Candidate functions are those having the same name and number of parameters as specified by the function call as well as the best fit based on their parameter type.

    If no candidate function is found, an error is returned.

The rules for selecting a best fit candidate user-defined function once its containing database has been determined are described in Function Overloading.