Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Returns an expr where all characters in from have been replaced with those in to.
Syntax
translate(expr, from, to)
Arguments
expr: ASTRINGexpression.from: ASTRINGexpression consisting of a set of characters to be replaced.to: ASTRINGexpression consisting of a matching set of characters to replacefrom.
Returns
A STRING`.
The function replaces all occurrences of any character in from with the corresponding character in to.
If to has a shorter length than from unmatched characters are removed.
Examples
> SELECT translate('AaBbCc', 'abc', '123');
A1B2C3
> SELECT translate('AaBbCc', 'abc', '1');
A1BC
> SELECT translate('AaBbCc', 'abc', '');
ABC
> SELECT translate('AaBbCc' COLLATE UTF8_LCASE, 'abc', '123');
112233