Re: [SQL] How to handle a requirement for nextval

From: "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it>
To: Jerome Knobl <jknobl(at)mandanet(dot)ch>
Cc: wwwadmin(at)wizard(dot)ca, PGsql <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] How to handle a requirement for nextval
Date: 1998-05-19 09:45:18
Message-ID: Pine.LNX.3.96.980519094343.412A-100000@proxy.bazzanese.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 19 May 1998, Jerome Knobl wrote:

> I have got the same trouble. I found a first inellegant solution. Is to
> create a function which make an increment like that :
> create function last98_20_rubriques() returns int4
> as 'Select max(ref98_20_rubriques) as next from DB98_20_rubriques;'
> language 'sql';
>
> But I read yesterday that I have to use e SEQUENCE like :
>
> create table toto (id int4 PRIMARY KEY, test varchar);
> create sequence step1 increment 1 start 1000 minvalue 1000 maxvalue
> 999999;
>
> And after that I have normaly to do :
> insert into toto (id,test) values (step1.nextval,'sdf');
> But It's don't work.
> If you can go further send me a mail (and sorry for my very bad english).

insert into toto (id,test) values (nextval('step1'),'sdf');

Jose'

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jose' Soares Da Silva 1998-05-19 09:50:07 Re: [SQL] How to handle a requirement for nextval
Previous Message Marin D 1998-05-19 07:54:53 Re: [SQL] Case in-sensitive searches