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: Sequence

Re: Sequence

From: Dante <dnotari_at_my-deja.com>
Date: Tue, 08 Jun 1999 13:42:42 GMT
Message-ID: <7jj6kg$l20$1@nnrp1.deja.com>


Andreas,
I am not sure if I understand your problem. As I see it you need to create for every table a own sequence.

Although you can use one sequence for all your tables,  you won't loose any "space" in the physical meaning.

In the trigger you just
select myseq.nextval
into :new.nr
from dual;

Regards
Dante

In article <375D0BB4.55E2B1A8_at_uni-muenster.de>,   "Andreas Sbrzesny" <sbrzesn_at_uni-muenster.de> wrote:
> Hello,
>
> we have got the following problem:
>
> there are several tables with primary keys named "nr" (NUMBER) and
> we are looking for a automatized generation of that primary key.
>
> We have tried to do that by a sequence,
>
> CREATE SEQUENCE SetNR INCREMENT BY 1 MINVALUE 1 NOMAXVALUE NOCACHE;
> INSERT cust (NR, NAME) VALUES (SetNr.NextVal, 'TestName');
>
> But that statement return eachtime it runs a global new number, so we
> loose a lot of
> dbspace.
>
> Who knows how to solve that problem via a sequence or a trigger (on
> insert).
>
> Thanks,
> Andreas
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Jun 08 1999 - 08:42:42 CDT

Original text of this message

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