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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Is there an equivalent of AutoNumber?

Re: Is there an equivalent of AutoNumber?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 11 Feb 2000 19:24:38 -0500
Message-ID: <lu99as041ddie41p9c11r1h7nijf1oueq7@4ax.com>


A copy of this was sent to "Patrick Joyal" <please.reply_at_to.the.newsgroup> (if that email address didn't require changing) On Fri, 11 Feb 2000 21:15:44 GMT, you wrote:

>I have some table in Access that use AutoNumber to ID a record.
>Is there some equivalent in Oracle? Do I have to use a TRIGGER to simulate
>it? If so, how?
>
>thanks
>
>Patrick

>

it would be a sequence and a trigger:

create or replace sequence my_seq;

create or replace trigger my_trigger
before insert on T for each row
begin

   select my_seq.nextval into :new.id from dual; 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 Feb 11 2000 - 18:24:38 CST

Original text of this message

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