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: Steve McDaniels <steve.mcdaniels_at_sierra.com>
Date: Sat, 2 Sep 2000 20:20:16 -0700
Message-ID: <8osftl$2fa$1@spiney.sierra.com>

It's not necessarily good "form" to depend on a primary key to be sequential.

<javah_at_njet.com> wrote in message news:8ooe4q$jqb$1_at_nnrp1.deja.com...
> 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 Sat Sep 02 2000 - 22:20:16 CDT

Original text of this message

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