OTRANSLATE in Teradata

OTRANSLATE in Teradata

OTRANSLATE in Teradata: 

  • Returns source_string with every occurrence of each character in from_string replaced with the corresponding character in to_string.
  • OTRANSLATE is an embedded services system function. It can be activated by invoking embedded services functions
  • Expressions passed to this function must have one of the following data types: CHAR or VARCHAR

Syntax:

OTRANSLATE(source_string,from_string,to_string)

Example – 1

SELECT OTRANSLATE('teradata point','dpo','tti');

In the above example character ‘d’ will replace with character ‘t’ and ‘p’,’o’ will replace with character ‘t’ and ‘i’ respectively.

Also Read – Oreplace in Teradata

Output

teratata piint

Example – 2

SELECT OTRANSLATE('teradata point','dpo','tt');

In the above example, characters ‘d’ and ‘p’ will replace with characters ‘t’ and ‘t’ respectively. Character ‘o’ also will remove from the source string.

Output

teratata tint

Example – 3

SELECT OTRANSLATE('teradata point','dp','tto');

In the above example, characters ‘d’ and ‘p’ will replace with characters ‘t’ and ‘t’ respectively. Character ‘o’ will be simply ignored.

Output

teratata toint