Examples | Function Selection | Teradata Vantage - Example: Function Selection for Numeric Types - 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™

Consider the following Sales functions and the corresponding specific name as specified in the SPECIFIC clause of the CREATE FUNCTION statement.

Function Name and Parameters Specific Name
Sales(Quantity INTEGER, Profit INTEGER) S1
Sales(Quantity INTEGER, Profit FLOAT) S2
Sales(Quantity FLOAT, ProfiQuantityt INTEGER) S3
Sales(Quantity FLOAT, Profit FLOAT) S4

The following table identifies which function Teradata Database invokes when none of the functions have parameter types that are identical to the corresponding argument types of the function call.

IF the data type of the first argument is … AND the data type of the second argument is … THEN Teradata Database invokes the function with the specific name …
BYTEINT INTEGER S1.

After testing the first argument, S1 and S2 remain on the list.

After testing the second argument, S1 is left.

DECIMAL SMALLINT S3.

After testing the first argument, S3 and S4 remain on the list.

After testing the second argument, S3 remains on the list.

The DECIMAL is converted to a FLOAT and the SMALLINT is converted to an INTEGER before the UDF is called.