Methods of generating UUID in Oracle

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.