Example: Replacing and Returning Query Characters - 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ā„¢

In the following query, the characters 'T' and 'h' are replaced with 'S' and 'p'. The character 'T' occurs twice in the from_string, but only the replacement character in the to_string that corresponds to the first occurrence of 'T' is used. That is, only 'S' is used to replace 'T'. Next, the character 'k' is replaced with 'x', and the extra characters 'y' and 'z' in the to_string are ignored. The resulting string is 'Spin and Spicx'.

   SELECT OTRANSLATE('Thin and Thick', 'ThTk', 'Sptxyz');