Syntax
IS_UUID(string_uuid)
Purpose
Returns 1 if the parameter is a valid UUID string; 0 if it is not a valid UUID; or NULL if the parameter is NULL. A valid value is one that can be parsed. That is, it has the correct length and contains only allowed characters (hexadecimal digits and optional hyphens and braces). The most common format is:
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
