Re: AutoNumber ?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 12 Nov 1999 07:57:04 -0500
Message-ID: <dA4sOIh69bJ+i3lNn7=oV2YznUF7_at_4ax.com>


A copy of this was sent to "Dinesh" <valigean_at_post1.com> (if that email address didn't require changing) On Fri, 12 Nov 1999 16:52:08 +0800, you wrote:

>Hi....
>
>IS there an equivalent for AutoNumber in Oracle ??
>
>Thanks
>

to autonumber some_column in a table T you would:

create sequence my_seq;

create or replace trigger x BEFORE INSERT on T for each row begin

   select my_seq.nextval into :new.some_column; end;

-- 
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
 
Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation
Received on Fri Nov 12 1999 - 13:57:04 CET

Original text of this message