Example: Function Selection for Character 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 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 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 …
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.