Re: sequence and stored procedure

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Renaud Tthonnart <thonnart(at)amwdb(dot)u-strasbg(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: sequence and stored procedure
Date: 2001-02-21 17:12:28
Message-ID: Pine.BSF.4.21.0102210905500.8237-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Wed, 21 Feb 2001, Renaud Tthonnart wrote:

> How can I use sequences in a stored procedure written with pl/pgsql?

What exactly are you trying to do? Pretty much you can call the
sequence functions you want to use on the sequence name you
want (you have to double the quotes around the name since it's
inside the quoted text of the function.

create function foo() returns opaque as
'
begin
NEW.y:=nextval(''seqseq'');
return NEW;
end;' language 'plpgsql';

create trigger footrig before insert or update on testfoo for
each row execute procedure foo();

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-02-21 17:15:44 Re: Inheritance Question
Previous Message Brent R. Matzelle 2001-02-21 17:06:35 Re: Re: Printing PostgreSQL reports