Declaration
IS_UUID(string_uuid)
Description
If the parameter is a valid UUID string, 1 is returned. If the parameter is not a valid UUID, 0 is returned. If the parameter is NULL, NULL is returned. "Valid" means the value is in a parsable format. That is, it has the correct length and contains only allowed characters (letters representing hexadecimal digits, and optional hyphens and braces). The following format is the most common:
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
The following format is also allowed:
aaaaaaaabbbbccccddddeeeeeeeeeeee
{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}
Examples
obclient> SELECT IS_UUID('6ccd780c-abcd-1026-9564-5b8c656024db');
+-------------------------------------------------+
| IS_UUID('6ccd780c-abcd-1026-9564-5b8c656024db') |
+-------------------------------------------------+
| 1 |
+-------------------------------------------------+
1 row in set
obclient> SELECT IS_UUID('6CCD780C-ABCD-1026-9564-5B8C656024DB');
+-------------------------------------------------+
| IS_UUID('6CCD780C-ABCD-1026-9564-5B8C656024DB') |
+-------------------------------------------------+
| 1 |
+-------------------------------------------------+
1 row in set
obclient> SELECT IS_UUID('6ccd780cabcd102695645b8c656024db');
+---------------------------------------------+
| IS_UUID('6ccd780cabcd102695645b8c656024db') |
+---------------------------------------------+
| 1 |
+---------------------------------------------+
1 row in set
obclient> SELECT IS_UUID('{6ccd780c-abcd-1026-9564-5b8c656024db}');
+---------------------------------------------------+
| IS_UUID('{6ccd780c-abcd-1026-9564-5b8c656024db}') |
+---------------------------------------------------+
| 1 |
+---------------------------------------------------+
1 row in set
obclient> SELECT IS_UUID('6ccd780c-abcd-1026-9564-5b8c6560');
+---------------------------------------------+
| IS_UUID('6ccd780c-abcd-1026-9564-5b8c6560') |
+---------------------------------------------+
| 0 |
+---------------------------------------------+
1 row in set
obclient> SELECT IS_UUID(RAND());
+-----------------+
| IS_UUID(RAND()) |
+-----------------+
| 0 |
+-----------------+
1 row in set