PostgreSQL TRANSLATE
From w3cyberlearnings
Contents |
Postgresql translate
Replace any character in a string that found in the set replaced with the corresponding character set in the replace.
Syntax translate
- string: is a string to be replaced
- set: is a set of string to look for
- replace: is a set of string to be replaced
translate(string, set, replace)
Example 1
test2=# SELECT translate('abcde','ae','13'); translate ----------- 1bcd3 (1 row)
Example 2
test2=# SELECT user_firstname, test2-# translate(user_firstname,'im','xy') test2-# FROM profile; user_firstname | translate ----------------+----------- Jim | Jxy king | kxng Jammi | Jayyx Bob | Bob (4 rows)