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

Home -> Community -> Usenet -> c.d.o.server -> Re: Sequence NextVal jumping 18 on reboot!

Re: Sequence NextVal jumping 18 on reboot!

From: Kenny Gump <kgump_at_mylanlabs.com>
Date: Fri, 15 Jan 1999 11:49:46 -0500
Message-ID: <369f71d6.0@news.mountain.net>


There is a parameter in your init.ora file cache_sequence_entries which tells Oracle how many sequence entries to cache in the SGA. The default is 20. So when Oracle starts it will cache however many it says. Once a value has been selected from a sequence, it is gone, no matter if you used it or the cache wasted it.

Kenny Gump
OCP 7.3 DBA



Adrian Harrison wrote in message <369f1c53.196021_at_news.globalnet.co.uk>...
>Using NT4 Server, Personal Oracle 7.3.4
>
>Please someone tell me I'm not going stupid but every time I reboot my PC
the NEXTVAL in a very
>simply sequence (see below) increases by 18!
>
>For example if the last CRAFT_ID used was 3 on reboot the new one's 21
>
>Here is the code - generated by Oracle Migration Wizard for MS Access!
>
>///////////////////////////////////////////////////////////////////////////
/////////////////

>CREATE SEQUENCE SEQ_NLS_CRAFTS
>INCREMENT BY 1 START WITH 1
>/
>CREATE TRIGGER TRG_NLS_CRAFTS
>BEFORE INSERT OR UPDATE ON NLS_CRAFTS
>FOR EACH ROW
>DECLARE
> iCounter NLS_CRAFTS.CRAFT_ID%TYPE;
> cannot_change_counter EXCEPTION;
>BEGIN
> IF INSERTING THEN
> Select SEQ_NLS_CRAFTS.NEXTVAL INTO iCounter FROM Dual;
> :new.CRAFT_ID := iCounter;
> END IF;
>
> IF UPDATING THEN
> IF NOT (:new.CRAFT_ID = :old.CRAFT_ID) THEN
> RAISE cannot_change_counter;
> END IF;
> END IF;
>
>EXCEPTION
> WHEN cannot_change_counter THEN
> raise_application_error(-20000, 'Cannot Change Counter Value');
>END;
>/
>///////////////////////////////////////////////////////////////////////////
/////////////////

>
>I can't for the life of me work out what the hell's going on!
>
>Any ideas
>
>Thanks
>
>Adrian Harrison
Received on Fri Jan 15 1999 - 10:49:46 CST

Original text of this message

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