GENERATE_UUID_BINARY scalar function
FL 508 The GENERATE_UUID_BINARY function returns the binary string representation of a universally unique identifier (UUID) by using the version 4 algorithm.
The schema is SYSIBM.
The result of the function is a BINARY(16) value.
The result cannot be null. GENERATE_UUID is a non-deterministic function.
Notes for GENERATE_UUID_BINARY
- UUID generation algorithm
-
Db2 for z/OS® supports generation of UUID values as defined in the version 4 algorithm defined in the RFC 4122 industry standard. For more information about the RFC 4122 industry standard, see https://www.ietf.org/rfc/rfc4122.html.
- Converting UUID values
-
To convert from the CHAR(36) form of a UUID value to a BINARY(16) representation of the value, use the VARBINARY_FORMAT scalar function.
To convert from the BINARY(16) form of a UUID value to the CHAR(36) representation of the value, use the VARCHAR_FORMAT_BINARY scalar function.
Example for GENERATE_UUID_BINARY
The following statement generates a UUID value as a BINARY(16) string value.
INSERT INTO EMP (ID)
VALUES (GENERATE_UUID_BINARY());
The result is similar to the following binary string value:
BX'D83D6360181841EB9804B622A1FE5492'

