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 - correction

Re: Non working sequence - correction

From: Frank van Bortel <f.van.bortel_at_vnl.nl>
Date: Fri, 15 Oct 1999 12:52:58 -0700
Message-ID: <3807861A.C35BC537@vnl.nl>


Frank van Bortel wrote:

> buurd_at_my-deja.com wrote:
>
> > Hi!
> >
> > If I have understood correct this should result in that "mytable.id"
> > has two different numbers:
> >
> > create sequence myseq;
> >
> > 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.
> >
> > Tia
> >
> > --
> > Roland Carlsson
> > Certified Java programmer
> > Skövde
> > Sweden
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> That's not the way sequences work. Select from them.

That should be "use a select", like:
select myseq.nextval from dual

> Your other table
> should have
> the same problem, that is all values are 0.
>
> --
> Met vriendelijke groet/kind regards,
>
> Frank van Bortel
> Technical consultant Oracle
>
> Work: Home:
> ---------------------------------- ----------------------------
> V&L Informatica BV Hunzestraat 4
> Palatijn 3, 7521 PN Enschede 7555 WB Hengelo
> PoBox 545, 7500 AM Enschede (31)074-2425046
> 053-4341500
Received on Fri Oct 15 1999 - 14:52:58 CDT

Original text of this message

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