Entering content frame

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 a NULL value

NULL value

y is NULL value

x remains unchanged

Example table: customer

Each occurrence of the ith letter in the first character string is replaced by the ith letter in the second one.

SELECT name, TRANSLATE (name,'or','es') new_name
FROM customer WHERE firstname IS NOT NULL AND city = 'Los Angeles'

NAME

NEW_NAME

Porter

Pestes

Peters

Petess

Randolph

Sandelph

Peters

Petess

Brown

Bsewn

Jackson

Jacksen

Adams

Adams

See also:

REPLACE(x,y,z)

 

Leaving content frame