Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Storing GUIDs in Oracle

Re: Storing GUIDs in Oracle

From: Noons <wizofoz2k_at_yahoo.com.au.nospam>
Date: Thu, 24 Jul 2003 00:22:24 +1000
Message-ID: <3f1e9ac2$0$31925$afc38c87@news.optusnet.com.au>


"Jeff Boenig" <jeff.boenig_at_elsitech.com> wrote in message news:3f1e9642$1_at_btitelecom.net...

>

> Is it possible to store GUIDs in Oracle databases? There doesn't appear to
> be a GUID data type in Oracle 9i. Could I store it as RAW(16)? If I do,
> would I be able to create an index on that column? Does Oracle 10i have
> support for GUID?

You know, from time to time it's probably worth reading a manual or two about Oracle...

in SQL Reference, function SYS_GUID, you'll find: <quote>

SYS_GUID generates and returns a globally unique identifier (RAW value) made up of 16 bytes. On most platforms, the generated identifier consists of a host identifier and a process or thread identifier of the process or thread invoking the function, and a nonrepeating value (sequence of bytes) for that process or thread.

Examples
The following example adds a column to the sample table hr.locations, inserts unique identifiers into each row, and returns the 32-character hexadecimal representation of the 16-byte RAW value of the global unique identifier:

ALTER TABLE locations ADD (uid_col RAW(32));

UPDATE locations SET uid_col = SYS_GUID();

SELECT location_id, uid_col FROM locations;

LOCATION_ID UID_COL

----------- ----------------------------------------
       1000 7CD5B7769DF75CEFE034080020825436
       1100 7CD5B7769DF85CEFE034080020825436
       1200 7CD5B7769DF95CEFE034080020825436
       1300 7CD5B7769DFA5CEFE034080020825436
.

</quote>

Is this enough?

--
Cheers
Nuno Souto
wizofoz2k_at_yahoo.com.au.nospam
Received on Wed Jul 23 2003 - 09:22:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US