Skip to main content
Substitutes specified characters within a string. It works by taking a string (source) as the input and replaces the from_string characters in source with to_string. This function is supported from v3.2.

Syntax

Parameters

  • source: supports the VARCHAR type. The source string to be translated. If a character in the source is not found in from_string, it is simply included in the result string.
  • from_string: supports the VARCHAR type. Each character in from_string is either replaced by its corresponding character in the to_string, or if there is no corresponding character (i.e. if to_string has fewer characters than the from_string, the character is excluded from the result string). See Examples 2 and 3. If a character appears multiple times in from_string, only its first occurrence is effective. See Example 5.
  • to_string: supports the VARCHAR type. The string used to replace characters. If more characters are specified in to_string than in the from_string argument, extra characters from to_string are ignored. See Example 4.

Return value

Returns a value of the VARCHAR type. Scenarios where the result is NULL:
  • Any of the input parameters is NULL.
  • The length of the result string after translation exceeds the maximum length (2147482624) of VARCHAR.

Examples

See also