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 15.4 and above
Returns true if the input is a valid UTF-8 string, otherwise returns false.
Syntax
is_valid_utf8(strExpr)
Arguments
strExpr: ASTRINGexpression.
Returns
A BOOLEAN, indicating whether the input STRING represents a valid UTF-8 string.
Examples
-- Simple example taking a valid string as input.
> SELECT is_valid_utf8('Spark')
true
-- Simple example taking a valid collated string as input.
> SELECT is_valid_utf8('SQL' COLLATE UTF8_LCASE)
true
-- Simple example taking a valid hexadecimal string as input.
> SELECT is_valid_utf8(x'61')
true
-- Example taking an invalid hexadecimal string as input (illegal UTF-8 byte sequence).
> SELECT is_valid_utf8(x'80')
false
-- Example taking an invalid hexadecimal string as input (illegal UTF-8 byte sequence).
> SELECT is_valid_utf8(x'61C262')
false