Usage Notes - Advanced SQL Engine - Teradata Database

SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-30
dita:mapPath
tpt1555966086716.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1145
lifecycle
previous
Product Category
Teradata Vantageā„¢

For positional n-gram matching, the position as well as the pattern must match when measuring similarity. The position value indicates how far away positionally the match may be between the 2 strings as follows:

  • If position is set to a value of zero, the match must be at the same position in the 2 strings.
  • If position is set to a value of x , the match must be within x positions in the 2 strings. For example, if position = 2, then the match must be within 2 positions in the 2 strings.

As an example, for a string of 'abc', the 1-grams (length =1) are 'a', 'b', and 'c'. The 2-grams (length =2) are 'ab' and 'bc'. The 3-gram (length = 3) is 'abc'. By definition, there are no 4-grams or greater.

The function returns zero in the following cases:

  • If the length argument is greater than the length of either string1 or string2.
  • If the length argument is <= 0 or if either string1 or string2 is an empty string.

Patterns beyond the length of 255 are ignored.