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: Non working sequence

Re: Non working sequence

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 15 Oct 1999 12:43:02 +0100
Message-ID: <939987943.6358.0.nnrp-13.9e984b29@news.demon.co.uk>

What environment are you working in ?
The following is listing as executed from SQL*Plus (Oracle 8.0.5)


SQL> create table address (id number primary key);

Table created.

SQL> create sequence myseq;

Sequence created.

SQL> insert into address(id) values (myseq.nextval);

1 row created.

SQL> insert into address(id) values (myseq.nextval);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from address;

       ID


        1
        2

--

Jonathan Lewis
Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk

Frank van Bortel wrote in message <380785AB.4037CBB4_at_vnl.nl>...
>> insert into adress(id) values(myseq.nextval);
>> insert into adress(id) values(myseq.nextval);
>>
>> ORA-00001: unique constraint (ROLAND.ADRESS_ID_PRIM) violated
>>
>> select id from adress;
>>
>> id
>> --
>> 0
>>
>> Q1: Why is id = 0?? myseq has a minimum of 1.
>> Q2: Why doesn't myseq.nextval update the number??
>>
>> When I created a dummy-table without the primary-key myseq works fine.
>> But not on the adress-table.
>>

>
>That's not the way sequences work. Select from them. Your other table
>should have
>the same problem, that is all values are 0.
>
>



Received on Fri Oct 15 1999 - 06:43:02 CDT

Original text of this message

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