TRANSLATE
All functions > STRING > TRANSLATE
Replaces characters in a string based on character-to-character mappings.
Syntax
TRANSLATE(expr, from, to)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string | VARCHAR | Yes | String to transform |
from_chars | VARCHAR | Yes | Characters to replace |
to_chars | VARCHAR | Yes | Characters to replace with (parallel mapping to from_chars) |
Returns
String with character-level replacements applied
Notes
- Character-by-character replacement (not substring)
- Each character in from_chars maps to corresponding character in to_chars
- If to_chars is shorter, extra from_chars are deleted
- Order matters: first occurrence in from_chars takes precedence