Calling a Function That is Overloaded | Teradata Vantage - Calling a Function That is Overloaded - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

If several functions have the same name, then Teradata Database uses the following steps to determine which function to invoke.

IF... THEN...
no argument in the function call is the NULL keyword if one of the functions has parameter types that are identical to the corresponding argument types of the function call, then Teradata Database selects that function.
If no function has parameter types that are identical to the corresponding argument types of the function call, then Teradata Database repeats the following test for each argument of the function call, starting with the first (left):
  • If the argument type of the function call fits the corresponding parameter type of any of the functions, in order of compatibility precedence, then keep those functions and eliminate the others.
  • If the argument type of the function call does not fit the corresponding parameter type of any of the functions, in order of compatibility precedence, then return an error.

For more information on the rules of compatible precedence, see Compatible Types.

any argument in the function call is the NULL keyword Teradata Database repeats the following test for each argument of the function call, starting with the first (left):
  • If the argument type of the function call fits the corresponding parameter type of any of the functions, in order of compatibility precedence, then keep those functions and eliminate the others.
  • If the argument is the NULL keyword, then treat the NULL as a wildcard that matches any data type and continue to the next argument. Do not eliminate any function.
  • If the argument type of the function call does not fit the corresponding parameter type of any of the functions, in order of compatibility precedence, return an error.
After testing each argument and not returning an error, Teradata Database uses the following rules:
  • If one function remains, then Teradata Database selects that function.
  • If more than one function remains, then Teradata Database returns an error.

    To avoid this error, you can explicitly cast the keyword NULL to the data type of the corresponding parameter of the overloaded UDF you want to use.

For more information on the rules of compatible precedence, see Compatible Types.