Important

Helios features are now enabled during weekly update windows and are no longer directly tied to SingleStore engine releases. Refer to the release notes to view the latest features available in your Helios cluster.

IS_UUID

The IS_UUID() function validates a UUID value.

Syntax

IS_UUID(string_uuid)

Arguments

string_uuid: 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:

    aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee

    where,

    • a ,b,c,d, and e represent hexadecimal characters. 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

    • Additional valid UUID formats include:

      • A continuous string of hexadecimal characters without hyphens (e.g., aaaaaaaabbbbccccddddeeeeeeeeeeee).

      • The format with hyphens, enclosed in curly braces (e.g., {aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}).

Examples

Returns 1 for a valid UUID value.

SELECT IS_UUID('e2a2461e-1a08-456b-9eee-cd5dc0998340')
AS result;
+------------+
|   result   |
+------------+
|          1 |
+------------+

Returns 1 for a valid UUID value.

SELECT IS_UUID('6701a3357fe041b5aca07f5c21c51dcf')
AS result;
+------------+
|   result   |
+------------+
|          1 |
+------------+

Returns 1 for a valid UUID value.

SELECT IS_UUID('{ae0770dd-3d5e-413b-a630-59f2efa3fdd4}')
AS result;
+------------+
|   result   |
+------------+
|          1 |
+------------+

Returns 0 for an invalid UUID value.

SELECT IS_UUID('b34a-4666-a35a-6bbbf349') AS result;
+--------+
| result |
+--------+
|      0 |
+--------+

Last modified:

Was this article helpful?