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: Problem with autosequence

Re: Problem with autosequence

From: Erika Grondzakova <Erika.Grondzakova_at_cern.ch>
Date: Fri, 01 Sep 2000 16:40:24 +0200
Message-ID: <39AFBFD8.497566C6@cern.ch>

Hello,

Have a look on the parameter CACHE while defining a sequence... From Oracle manual:
"CACHE specifies how many values of the sequence Oracle preallocates and keeps in memory for faster access. This integer value can have 28 or fewer digits. The minimum value for this parameter is 2.... If you omit both the CACHE parameter and the NOCACHE option, Oracle caches 20 sequence numbers by default."

Hth,

Erika

javah_at_njet.com wrote:
>
> Hi.
>
> I am in trouble with the auto sequence.
> I have multible tables in db. And each table has its sequence, eg.
>
> TABLE CREATED THIS WAY:
>
> create table test(
> test_id number(20) primary key,
> other_id number(20),
> name varchar(128));
>
> SEQUENCE THIS WAY:
>
> create sequence test_id_seq
> start with 1
> increment by 1;
>
> And I add the information into the table this way:
>
> insert into test (test_id, order_id, name) values (test_id_seq.nextval,
> 12, "asdf");
>
> Which works pretty nicely... But the ID doesn´t increment by 1 as it is
> supposed to. Or doesn´t do it all the time by one. Sometimes the gap can
> be about 20 sometimes 1... Sometimes something else. I haven´t got a
> clue what defines the increment or why do some numbers get skipped.
>
> The whole insert sentence is constructed with some php code, yes. But
> the name of the sequence and the name of the table is coming from
> exactly the same variable, so if the variable is wrong the sentence
> wouldn´t go thru anyway...
>
> Also the inserts are done thru web pages, so the connection is opened
> and closed frequently, and it does seem a bit like the longer gaps comes
> between every connection... Weird for me, but my Oracle knowledge is
> limited. Might be possible that I have missed something vital here?
> Maybe the sequence on its own is not enough???
>
> Help me out here, anyone who has more clue out of Oracle...
>
> -javah
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Fri Sep 01 2000 - 09:40:24 CDT

Original text of this message

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