
# translate
将 input 字符串中出现的 from 中的字符逐个替换为 to 中对应位置的字符。
例如：将 abcde 中的 bcd 替换成 BCD：
```
translate("abcde", "bcd", "BCD")
```
#### 命令格式
```
translate(string <input>, string <from>, string <to>)
```
#### 参数说明
| 参数    | 是否必选 | 参数类型   | 说明        |
|:---|:---|:---|:---|
| input | 是    | STRING | 待替换的字符串。  |
| from  | 是    | STRING | 待替换的字符集合。 |
| to    | 是    | STRING | 替换后的字符集合。 |
   
#### 返回值说明
返回 STRING 类型。
![](https://support.huaweicloud.com/sqlref-spark-aidatalake/public_sys-resources/note_3.0-zh-cn.png)
如果任一输入参数值为 NULL，返回 NULL。
#### 示例代码
返回 A1B2C3。
```
SELECT translate('AaBbCc', 'abc', '123');
```
