Updated on 2026-11-06 GMT+08:00

translate

Replaces characters in the input string that appear in from with the corresponding characters at the same position in to.

For example: Replace bcd in abcde with BCD:

translate("abcde", "bcd", "BCD") 

Syntax

translate(string <input>, string <from>, string <to>) 

Parameters

Parameter

Mandatory

Type

Description

input

Yes

STRING

The string to be replaced.

from

Yes

STRING

The set of characters to be replaced.

to

Yes

STRING

The set of replacement characters.

Return Values

Returns a value of type STRING.

If any input parameter is NULL, NULL is returned.

Example Code

Returns A1B2C3.

SELECT translate('AaBbCc', 'abc', '123');