top of page
CerebroSQL

MySQL: 

BIN_TO_UUID

BIN_TO_UUID(binary_uuid), BIN_TO_UUID(binary_uuid, swap_flag)

BIN_TO_UUID() is the inverse of UUID_TO_BIN(). It converts a binary
UUID to a string UUID and returns the result. The binary value should
be a UUID as a VARBINARY(16) value. The return value is a utf8 string
of five hexadecimal numbers separated by dashes. (For details about
this format, see the UUID() function description.) If the UUID argument
is NULL, the return value is NULL. If any argument is invalid, an error
occurs.

BIN_TO_UUID() takes one or two arguments:

o The one-argument form takes a binary UUID value. The UUID value is
assumed not to have its time-low and time-high parts swapped. The
string result is in the same order as the binary argument.

o The two-argument form takes a binary UUID value and a swap-flag
value:

o If swap_flag is 0, the two-argument form is equivalent to the
one-argument form. The string result is in the same order as the
binary argument.

o If swap_flag is 1, the UUID value is assumed to have its time-low
and time-high parts swapped. These parts are swapped back to their
original position in the result value.

For usage examples and information about time-part swapping, see the
UUID_TO_BIN() function description.

URL: https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html

Example

bottom of page