Example: Function Selection for Character 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 Find_Text functions and the corresponding specific name as specified in the SPECIFIC clause of CREATE FUNCTION.

Function Name and Parameters Specific Name
Find_Text(SearchedString CHAR(40), Pattern VARCHAR(10)) F1
Find_Text(SearchedString VARCHAR(10), Pattern CHAR(20)) F2
Find_Text(SearchedString CHAR(20), Pattern CHAR(10)) F3

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
VARCHAR(40) CHAR(50) invokes the function with the specific name F2.

After testing the first argument, F2 remains on the list.

After testing the second argument, F2 is left (exact match).

The length of character string is not considered, so truncation is possible.

VARCHAR(80) VARCHAR(20) returns an error.

After testing the first argument, F2 remains on the list.

After testing the second argument, nothing remains on the list. F2 is not selected because the function is asking for a VARCHAR and the only option is a CHAR, which is of a lower precedence than the VARCHAR.

Do not use CHAR as a parameter type if you want a function to be found with a VARCHAR argument.