According to the rfc4122 specification, UUID is a 128 bits long identifier used to uniquely identify objects in various applications and systems. Many programming languages gives us ability to generate UUID using API, however Oracle don't provide a function which can do this directly. We need to use some other indirect solutions:
1. Using sys_guid function
Oracle provide a function called sys_guid() which generates unique identifiers and it can be used, with a simple modification, to generate UUIDs.
Result:
Now we can can use regexp_replace and rawtohex function to generate random UUID.
Result:
2. Using Java based function
Another method to generate unique indentifiers in Oracle is to use Java based function that will generate UUIDs using java.util API.
Result:
3. Using dbms_crypto and utl_raw functions
To use dbms_crypto function you will need to grant special permissions to your database user:
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}