Example: Overloaded Function with Distinct Parameter Data 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
ft:locale
en-US
ft:lastEdition
2025-03-30
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
qnu1472247494689
lifecycle
latest
Product Category
Teradata Vantage™

Consider the following C functions I_Sales and D_Sales:

void I_Sales( INTEGER *quantity,
              INTEGER *result,
              char    sqlstate[6] )
{
     ...
}
 
void D_Sales( DECIMAL8 *quantity,
              INTEGER  *result,
              char     sqlstate[6] )
{
     ...
}

The name you use in the CREATE FUNCTION statement for I_Sales can be the same name you use in the CREATE FUNCTION statement for D_Sales, because the data type of the quantity parameter for I_Sales is distinct from the data type of the quantity parameter for D_Sales.

Here are two SQL function definitions that overload the function name Sales:

CREATE FUNCTION Sales(Quantity DECIMAL(15,6))
RETURNS INTEGER
SPECIFIC D_Sales
LANGUAGE C
NO SQL
PARAMETER STYLE TD_GENERAL
EXTERNAL;
   
CREATE FUNCTION Sales(Quantity INTEGER)
RETURNS INTEGER
SPECIFIC I_Sales
LANGUAGE C
NO SQL
PARAMETER STYLE TD_GENERAL
EXTERNAL;