TRANSLATE (Lakehouse v1)
Transforms a given string by replacing specific characters with corresponding replacements, as defined by the provided mapping.
Analyze Syntax
Section titled “Analyze Syntax”func.translate('<inputString>', '<charactersToReplace>', '<replacementCharacters>')Analyze Examples
Section titled “Analyze Examples”func.translate('databend', 'de', 'DE')┌────────────────────────────────────────┐│ func.translate('databend', 'de', 'DE') │├────────────────────────────────────────┤│ DatabEnD │└────────────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”TRANSLATE('<inputString>', '<charactersToReplace>', '<replacementCharacters>')| Parameter | Description |
|---|---|
<inputString> | The input string to be transformed. |
<charactersToReplace> | The string containing characters to be replaced in the input string. |
<replacementCharacters> | The string containing replacement characters corresponding to those in <charactersToReplace>. |
SQL Examples
Section titled “SQL Examples”-- Replace 'd' with '$' in 'databend'SELECT TRANSLATE('databend', 'd', '$');
---$ataben$
-- Replace 'd' with 'D' in 'databend'SELECT TRANSLATE('databend', 'd', 'D');
---DatabenD
-- Replace 'd' with 'D' and 'e' with 'E' in 'databend'SELECT TRANSLATE('databend', 'de', 'DE');
---DatabEnD
-- Remove 'd' from 'databend'SELECT TRANSLATE('databend', 'd', '');
---ataben