is_valid_utf8
function
Applies to: Databricks SQL Databricks Runtime 15.4 and later
Returns true
if the input is a valid UTF-8 string, otherwise returns false
.
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