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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Sequence/autonumber

Re: Sequence/autonumber

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/07/24
Message-ID: <964505189.3225.0.pluto.d4ee154e@news.demon.nl>#1/1

"Kalle W" <kawi9365NOkaSPAM_at_student.uu.se.invalid> wrote in message news:05c2deba.b95c4f8f_at_usw-ex0105-035.remarq.com...
>
> How do I accomplish what in other database-engines are called
> autonumber? Like in Access for example. That is unique
> generation of indexes/record-keys. Is there a datatype that
> manages this automatically?
>
> /Kalle W
>
>
>
>
> -----------------------------------------------------------
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
>

No, you'll need to use a sequence and either use insert into table foo
values (fooseq.nextval...)
or create a before insert for each row trigger on foo assigning fooseq.nextval to :new.<primarykeycolumn>

This approach may look cumbersome, but the advantage is a sequence is not bound to one single table.

Hth,

Sybrand Bakker, Oracle DBA Received on Mon Jul 24 2000 - 00:00:00 CDT

Original text of this message

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