Method Name Overloading | C/C++ UDMs | Teradata Vantage - Method Name Overloading - Analytics Database - Teradata Vantage

SQL External Routine Programming

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
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
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 Vantage uses to determine which method to invoke when the method is overloaded are the same rules used to determine which function to invoke when a user calls a UDF that is overloaded.

For details, see Calling an Overloaded Function.

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.