TRANSLATE(x,y,z) 

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 (see data type)

y is NULL value

x remains unchanged

 

Model table: customer

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

Randolph

Randolph

Smith

Smith

Peters

Pitirs

Baker

Bokir

Jenkins

Jinkins

Adams

Adoms

 

See also:

REPLACE(x,y,z)