Method Name Overloading | C/C++ UDMs | Teradata Vantage - Method Name Overloading - 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™

UDMs support method name overloading in the same manner that UDFs support function name overloading: you can define several methods that have the same name but are different from each other in such a way to make each method unique.

The name that is overloaded is specified in the METHOD specification in the CREATE TYPE statement as the name to use to invoke the UDM. You must provide a unique C or C++ function for each UDM with the same name.

Characteristics of a Unique Method

Methods that have the same name are unique if any of the following is true:

  • The number of parameters is different.
  • The parameter data types are distinct from each other.

    For the rules on which parameter data types are distinct from each other, see Parameter Types in Overloaded Functions.

Relationship to CREATE TYPE and CREATE METHOD Statements

The name that is overloaded is the name that immediately follows the METHOD keyword in the CREATE TYPE statement.

Each time you use the METHOD specification in the CREATE TYPE statement to overload a method name, you must specify:

  • A parameter list that satisfies the characteristics of a unique function
  • A unique name in the SPECIFIC clause

Each time you use the CREATE METHOD statement to install an overloaded method, you must specify a different C or C++ function.

Calling a Method That is Overloaded

The rules that Teradata Database uses to determine which method to invoke when the method is overloaded are the same rules that Teradata Database uses to determine which function to invoke when a user calls a UDF that is overloaded.

For details, see Calling a Function That is Overloaded.

Using TD_ANYTYPE Parameters as an Alternative to Overloading Method Names

You can use TD_ANYTYPE parameters to reduce the number of overloaded methods needed to support routines that have constant parameter counts but differing parameter data types. TD_ANYTYPE parameters can accept any system-defined data type or user-defined type; therefore, you can create a single method that can support a multitude of data types.

For more information, see Using TD_ANYTYPE Parameters as an Alternative to Overloading Function Names.