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: Maximus <qweqwe_at_qwqwewq.com>
Date: Wed, 23 Jul 2003 19:13:32 GMT
Message-ID: <w7BTa.496378$ro6.11799431@news2.calgary.shaw.ca>


"Jeff Boenig" <jeff.boenig_at_elsitech.com> wrote in message news:3f1ed48a$1_at_btitelecom.net...
> I did check the SQL Reference and the only occurrence of GUID that I found
> (aside from alot of hits on the word Guide) is the documentation for the
> SYS_GUID() function. That answers the question of whether a GUID can be
> stored in the database. The other part of my question is whether you can
use
> it as a primary key. The documentation talks about RAW and LOB datatypes
> together and states that LOB columns cannot be used as primary keys and
> cannot be indexed. It doesn't say whether the same applies to RAW columns.
>
> I was also hoping to find out if anyone has tried this with the ADO.NET to
> see if it converts the column properly. I was also hoping to get some
> feedback from people who have used GUIDs as primary keys in Oracle
> databases, to find out what they thought of the technique.
>
> There isn't a straightforward answer to my questions in the SQL Reference.
I
> want to design my database to work equally well with MS-SQL and Oracle,
> which is why I thought posting these questions on this newsgroup would be
a
> constructive thing to do.
>
> The purpose of a newsgroup is exchange ideas and experience. That's what I
> was looking for and I think that my questions are relevant.
>
> If you didn't think my question was worthy of answer, you shouldn't have
> posted a response. I think you took the trouble to respond because you get
> some sort of weird satisfaction out of telling someone to RTFM. No, I
don't
> know as much about Oracle as you do. You're soooo smart. Maybe the hostile
> response had something to do with my mention of MS-SQL.

Logially, one would begin by examining the SQL reference to discover that the sys_guid() function returns a 16 byte raw (binary) value. Examining the SQL reference again, one discovers that a datatype of RAW(16) is sufficient to store the binary value returned by sys_guid(). Examining the SQL reference once again, one discovers that one can indeed create indexes and primary keys on raw (binary) datatypes. Yes, RTFM! Received on Wed Jul 23 2003 - 14:13:32 CDT

Original text of this message

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