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.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantageā„¢

If several functions have the same name, then Vantage 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 Vantage selects that function.
If no function has parameter types that are identical to the corresponding argument types of the function call, then Vantage 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 Vantage 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, Vantage uses the following rules:
  • If one function remains, then Vantage selects that function.
  • If more than one function remains, then the system 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.