Function Name Overloading - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

Function names need not be unique within a function class; however, functions from two different function classes cannot have the same name within the same database or user. Vantage uses the parameter types of identically named functions to distinguish among them, so it is imperative that the parameter types associated with overloaded function names be sufficiently different to be distinct.

The system uses the precedence order for compatible type parameters to determine which function is to be invoked when several functions having the same name must be differentiated by their parameter types.

Vantage follows a set of parameter rules to determine the uniqueness of a function name. These rules are provided in the following list:

  • The following numeric parameter types listed in order of precedence for determining function uniqueness. For example, a BYTEINT fits into a SMALLINT and a SMALLINT fits into an INTEGER. Conversely, a FLOAT does not fit into an INTEGER without a possible loss of information.
    The types are distinct and compatible. Types sharing a number are synonyms and are not distinct from one another.
    • BYTEINT
    • SMALLINT
    • INTEGER
    • DECIMAL
    • NUMERIC

      The size specification for DECIMAL and NUMERIC types does not affect the distinctiveness of a function. For example, DECIMAL(8,3) and DECIMAL(6,2) are identical with respect to determining function uniqueness.

    • FLOAT, DOUBLE PRECISION, REAL
  • The following character parameter types are listed in order of precedence for determining function uniqueness.
    The types are distinct and compatible. Types sharing a character are synonyms and are not distinct from one another. The length specification of a character string does not affect the distinctiveness of a function. For example, CHARACTER(10) and CHARACTER(5) are identical with respect to determining function uniqueness. CHARACTER SET clauses also have no effect on the determination of function uniqueness.
    • CHARACTER
    • VARCHAR, CHARACTER VARYING, LONG VARCHAR
    • CHARACTER LARGE OBJECT
  • The following graphic parameter types are distinct and compatible. Types sharing a bullet are synonyms and are not distinct from one another.
    • GRAPHIC
    • VARGRAPHIC
    • LONG VARCHAR
    • CHARACTER SET GRAPHIC
  • The following byte parameter types are distinct and compatible:
    • BYTE
    • VARBYTE
    • BINARY LARGE OBJECT
  • All date, time, timestamp, and interval parameter types are distinct.
  • If the number of parameters in identically named existing functions is different or if the function parameter types are distinct from one another in at least one parameter, then the function being defined is considered to be unique.
  • If more than one function has the same function_name, then you must supply a specific_function_name.
  • You can only overload function names within the same class within a given database. For example, you cannot have a scalar function and an aggregate function with the same function_name within the same database.