Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Problem with autosequence
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:23:36 CDT