IS_UUID
Syntax

Description of the illustration is_uuid.gif
IS_UUID checks whether the input argument is a valid UUID string. It returns TRUE when the input conforms to an accepted UUID format, FALSE otherwise, and NULL when the input is NULL.
The input can be in canonical form or specified as 32 hexadecimal characters. It can be enclosed in braces. If the input is a string literal, enclose it in single quotation marks.
With one argument, IS_UUID accepts Version 4, Version 5, and Version 7 UUIDs in the following formats:
xxxxxxxxxxxxVxxxYxxxxxxxxxxxxxxx
xxxxxxxx-xxxx-Vxxx-Yxxx-xxxxxxxxxxxx
{xxxxxxxxxxxxVxxxYxxxxxxxxxxxxxxx}
{xxxxxxxx-xxxx-Vxxx-Yxxx-xxxxxxxxxxxx}
In these formats:
xis a hexadecimal digit.Vis the version digit:4,5, or7.Yis the variant digit:8,9,A, orB.- Hexadecimal letters are case-insensitive.
A string of 32 zeros that denotes a Nil UUID or 32 f characters that denotes a Universal UUID is also accepted.
To check for a specific UUID version, specify IS_UUID(uuid_string, version_specifier). The function returns TRUE if the input is a UUID of the specified version and FALSE otherwise.
For Version 5, you can also specify IS_UUID(uuid_string, 5, namespace, name). This form checks the UUID by using the namespace and name from which it was generated.
The following statement checks whether the input is a Version 4 UUID:
SELECT IS_UUID(
'{e24e8de0-d663-428f-baaa-1be5f019cd25}',
4
)
FROM DUAL;
The following statement checks a Version 5 UUID using the DNS namespace and the name www.example.com:
SELECT IS_UUID(
RAW_TO_UUID(UUID(5, 'dns', 'www.example.com')),
5,
'dns',
'www.example.com'
)
FROM DUAL;
Usage Notes
- The one-argument form of
IS_UUIDvalidates the UUID format. The version-specific form also validates the requested UUID version. - The Version 5 form requires a namespace and a nonempty name.
- Invalid version, namespace, or name values result in an error.