- Categories:
TRY_TO_UUID¶
A special version of TO_UUID that performs the same operation — that is, converts an input expression to a UUID value — but with error handling support. If the conversion can’t be performed, it returns a NULL value instead of raising an error.
For more information, see the following topics:
Syntax¶
TRY_TO_UUID( <string_expr> )
Arguments¶
string_exprA string expression in UUID format.
Returns¶
Returns a value of type UUID or NULL when TO_UUID would return an error.
Examples¶
The following example returns NULL because the input string isn’t a UUID:
SELECT TRY_TO_UUID('not a uuid');
+--------------------------------------+
| TRY_TO_UUID('NOT A UUID') |
|--------------------------------------|
| NULL |
+--------------------------------------+
For examples that convert an input expression to a UUID value, see TO_UUID.