नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
Applies to:
Databricks SQL
Databricks Runtime 15.4 and above
Returns the input value if it corresponds to a valid UTF-8 string, or NULL otherwise.
Syntax
try_validate_utf8(strExpr)
Arguments
strExpr: ASTRINGexpression.
Returns
A STRING which is byte-wise equal to strExpr in case it represents a valid UTF-8 string, or NULL otherwise.
To return an error if the input is not a valid UTF-8 string, use the validate_utf8 function.
Examples
– Simple example taking a valid string as input.
> SELECT try_validate_utf8('Spark')
Spark
– Simple example taking a valid collated string as input.
> SELECT try_validate_utf8('SQL' COLLATE UTF8_LCASE)
SQL
– Simple example taking a valid hexadecimal string as input.
> SELECT try_validate_utf8(x'61')
a
– Example taking an invalid hexadecimal string as input (illegal UTF-8 byte sequence).
> SELECT try_validate_utf8(x'80')
NULL
- Example taking an invalid hexadecimal string as input (illegal UTF-8 byte sequence).
> SELECT try_validate_utf8(x'61C262')
NULL