IS_ UUID
On this page
Validates a UUID value.
Syntax
IS_UUID(string_uuid)
Arguments
string_
: A string UUID value.
Return Type
TINYINT
: Returns 1
or 0
to indicate TRUE
or FALSE
, respectively.
-
If the argument is a valid string format UUID value, returns
1
. -
If the argument is not a valid UUID value, returns
0
. -
If the argument is a NULL value, returns SQL
NULL
.
Remarks
-
A UUID is considered valid if it is a 128 bit identifier represented as a 32-character hexadecimal string divided into five fields separated by hyphens in the following format:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
where,
-
x
represents a hexadecimal character.Each pair of characters must be in the 00-FF
range. -
The length (number of characters) and size of each field are as follows:
Field
Length
Size
Field1
8
32 bits
Field2
4
16 bits
Field3
4
16 bits
Field4
4
16 bits
Field5
12
48 bits
-
Examples
Returns 1 for a valid UUID value.
SELECT IS_UUID('e2a2461e-1a08-456b-9eee-cd5dc0998340')AS result;
+------------+
| result |
+------------+
| 1 |
+------------+
Returns 0 for an invalid UUID value.
SELECT IS_UUID('b34a-4666-a35a-6bbbf349') AS result;
+--------+
| result |
+--------+
| 0 |
+--------+
Last modified: November 12, 2024