Syntax
IS_UUID(string_uuid)
Purpose
If the value of the argument is a valid string UUID, 1 is returned. If the value of the argument is not a valid string UUID, 0 is returned. If the argument is NULL, NULL is returned. A valid value means that the format of the value can be parsed. To be specific, the value has a correct length and contains only allowed characters: letters used to represent hexadecimal numbers and optional dashes and braces. The most common format is as follows:
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