Re: Identity columns in Oracle?

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/06/22
Message-ID: <31cb4e2c.959980_at_dcsun4>#1/1


On 21 Jun 1996 20:40:08 GMT, Peter Gurmann <pgurmann_at_via.at> wrote:

>Eric,
>
>there are two ways to implement this:
>1. usage of a SEQUENCE (a DB object which provides unique numbers) and
>writing of a DB Trigger which checks whether there is a NULL value, if
>yes --> get the next SEQUENCE number. The fastest way but the numbers are
>not guaranteed to be consecutive (wasted numbers).

1a. usage of a SEQUENCE without a database trigger can be used as well, for example:

insert into table ( a, b, c ) values ( some_sequence.nextval, :b, :c );

>2. getting the max number from that table, add 1 and use it as a new UID.
>Performance could be bad but the numbers - because of transaction logic -
>are consecutive.
>
>btw, the pseudo column ROWID (phys addr of the row) may be something like
>a Identity column, but NEVER use it for referential integrity, after
>imp/exp ROWIDs change !
>
>good luck !
>
>Peter
>

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com -- Check out our web site! Brand new, uses Oracle Web Server and Database


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Sat Jun 22 1996 - 00:00:00 CEST

Original text of this message