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: <buurd_at_my-deja.com>
Date: Fri, 15 Oct 1999 13:42:13 GMT
Message-ID: <7u7avh$hcb$1@nnrp1.deja.com>


I've got an oracle 8.1.5 server. I'm primary working with it from Enterprice Server client shema manager from where the most tables is created. But I have looked at the sqlstatements and they look correct. I just can't figure out why I can't insert values with a sequence in the primary key columns. It works manually but the idnumbers must be created by automation.

By the way: In Oracle Press: Oracle8: The compleate Reference creates sequences my way at page 498. Should I burn the book??

Tia

In article <939987943.6358.0.nnrp-13.9e984b29_at_news.demon.co.uk>,   "Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> wrote:
>
> 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.
> >
> >
>
>

--
Roland Carlsson
Certified Java programmer
Skövde
Sweden

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Oct 15 1999 - 08:42:13 CDT

Original text of this message

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