- Categories:
String & binary functions (General) , Data generation functions
UUID_STRING¶
Generates either a version 4 (random) or version 5 (named) RFC 4122-compliant universally unique identifier (UUID) as a formatted string.
Syntax¶
Arguments¶
'uuid'A valid UUID string. This value is the namespace used to generate the returned UUID.
'name'The name used to generate the returned UUID.
Returns¶
This function returns a 128-bit value, formatted as a string (VARCHAR data type).
Usage notes¶
UUID_STRING supports generating two versions of UUIDs, both compliant with RFC 4122:
A version 4 (random) UUID is returned when no arguments are provided to the function. For random-number generation, the 64-bit Mersenne twister known as MT19937-64 is used.
A version 5 (named) UUID can be produced by providing a
uuidstring (known as the namespace) as the first argument and anamestring as the second argument.
Examples¶
Generate a random UUID:
Generate a named UUID:
Create a table and insert random UUIDs: