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

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 Vantage 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 Vantage 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.