Methods for generating UUID in Oracle Download the Lofter client provides a function to generate the UUID in Oracle SQL sys_guid:http://download.oracle.com/docs/cd/e11882_01/ Server.112/e17118/functions187.htm#i79194http://en.wikipedia.org/wiki/universally_unique_identifiersql> Select Sys_guid () from dual; Sys_guid ()--------------------------------A8f662b86e7413fee040970a437c6bd7 But the function has the following problem: 1. The return type is raw 2. No-(dash) delimiter 3. Return the letter uppercase in order to make the resulting UUID conform to RFC 4122 's standard (http://tools.ietf.org/html/rfc4122) creation function as follows, the test passes. CREATE OR replacefunction Get_uuidreturn varcharisguid VARCHAR (50); Beginguid: = Lower (Rawtohex (Sys_guid ())); Returnsubstr (guid,1,8) | | ' -' | | substr (guid,9,4) | | ' -' | | substr (guid,13,4) | | ' -' | | substr (guid,17,4) | | ' -' | | SUBSTR (guid,21,12); END Get_uuid; Sql> select Get_uuid from dual; get_ UUID--------------------------------------------------------------------------------a8f662b8-6e7a-13fe-e040-970a437c6bd7s Ql>/get_ UUID--------------------------------------------------------------------------------a8f662b8-6e7b-13fe-e040-970a437c6bd7s Ql>/get_uuid--------------------------------------------------------------------------------A8f662b8-6e7c-13fe-e040-970a437c6bd7
Methods of generating UUID in Oracle