Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: GUID as primary key
Andreas Mosmann wrote:
> Hi,
>
> <Oracle 9.2i>
> I got 2 questions:
>
> Is there a package (or something else) where I can get a GUID from the
> oracle system? (something like SELECT DBMS_GUID.GenerateGUID FROM DUAL)
SQL> select sys_guid() from dual;
SYS_GUID()
Why not use a sequence instead? Sequences are tailor made for scaling with concurrent usage. I doubt that SYS_GUID is.
> You can give a column in a table a default value. How can I give oracle
> a function instead of a plain value so that this function is called
> everytime a new row is generated?
Why not simply code it in the INSERT statement? Is it honestly such a good idea to hide the sequence number from the INSERT? What does it buy you? What does it cost you in the long run ito maintenance when a developer touches that code?
I've heard some good arguments for why not obfuscate the use of sequences with the counter arguments not being that strong.
-- BillyReceived on Mon Jun 20 2005 - 07:14:30 CDT
![]() |
![]() |