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/Trigger problem

Re: Sequence/Trigger problem

From: Dirk Tschentscher <dirk.tschentscher_at_volkswagen.de>
Date: Wed, 30 Oct 2002 16:00:52 +0100
Message-ID: <apos85$l9o1@doiweb4.volkswagen.de>


Hi Volker,
I think you're sequence is caching the values like the following sequence

CREATE SEQUENCE ABC_SEQ
 INCREMENT BY 1
 START WITH 1
 MINVALUE 1
 CACHE 20 -- this means 20 values are cached at one select for one session --
 then a sequence is hopping from 1 to 21 session 1 selects the values from 1 to 20, session 2 gets the "next" value 21...

Regards

    Dirk

"Volker Schmid" <Info_NoSpam_at_Inspirant.de> schrieb im Newsbeitrag news:apopva$3sc$1_at_news.online.de...
> Hello,
>
> I have a strange problem with my sequence in combination with a trigger.
> The case is simple and well known: I need a auto-increment ID!
>
> I use this to create the auto-increment:
>
> CREATE SEQUENCE USERS_SEQ START WITH 1 INCREMENT BY 1;
>
> CREATE OR REPLACE TRIGGER "TR_USERS"
> BEFORE INSERT ON "USERS"
> FOR EACH ROW
> BEGIN
> SELECT USERS_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
> END;
>
> For other tables I do exactly the same with other sequence/trigger-names.
>
> It works but there is something I don't understand:
>
> Why is the sequence hopping sometimes from the value 1 to 21 or from 24 to
> 48? I really want some values without those jumps.
> What is wrong or do I missunderstood something about sequences?
> Is it possible that other sequences interact with my needed sequence? Or
is
> the problem that I use UPDATE Users WHERE... on this?
>
> Any ideas, tips or secrets?
>
> Thank you
>
> Volker
>
>
Received on Wed Oct 30 2002 - 09:00:52 CST

Original text of this message

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