TRANSLATE(x,y,z) is a
string function that replaces the ith character of the character string y with the ith character of the character string z in the character string x. The character strings y and z must have the same length.
Result of the TRANSLATE(x,y,z) function | |
x is NULL value |
NULL value |
y is NULL value |
x remains unchanged |
Model table:
Each occurrence of the ith letter in the first character string is replaced by the i th letter in the second one.
SELECT name, TRANSLATE (name, 'ae', 'oi') name_new
FROM customer WHERE firstname IS NOT NULL AND city = 'Los Angeles'
NAME |
NAME_NEW |
Porter |
Randolph |
Peters |
Smith |
Peters |
Pitirs |
Brown |
Bokir |
Jackson |
Jinkins |
Adams |
Adams |
See also:
REPLACE(x,y,z)