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: a trigger to increment key ????

Re: a trigger to increment key ????

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 22 Aug 2000 19:10:56 +0200
Message-ID: <966967730.29976.4.pluto.d4ee154e@news.demon.nl>

"Jerome Carpene" <jerome.carpene_at_aliso.com> wrote in message news:8nubn9$cf5$2_at_wanadoo.fr...
> Well I intend to use a trigger to compute the new row >

[snip]

> otherwise how to have that kind of auto increment key ?
>
> Thanks for your help :))
>
> --
> Jérôme CARPENE
>
>

Use a sequence
create sequence fooseq start with 1 increment by 1; -- etc. grant select on <anyone needs to have access to it>; create (public synonym) fooseq for fooseq;

use
select fooseq.nextval
into :new.<key column>
from dual;

in your trigger.

That should be all.

Hth,

Sybrand Bakker, Oracle DBA Received on Tue Aug 22 2000 - 12:10:56 CDT

Original text of this message

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