Categories: String

TRANSLATE

Translates the base expression from the source characters/expression to the target characters/expression.

Syntax

TRANSLATE(base_expression varchar, source_characters varchar, target_characters varchar) → varchar

  • base_expression: The string to translate.
  • source_characters: A string with all the characters in the base expression that need translating. Each character in this string will be replaced with the corresponding character from the target_characters expression or ommitted from the string if target_characters expression has less characters than the source_characters.
  • target_characters: A string containing all the characters to replace the original characters with.

Examples

SELECT TRANSLATE('*a*bX*dYZ*','XYZ*','cef');
-- abcdef