Re: PostgreSQL sequence within function

From: Clark Allan <clarka(at)gmail(dot)com>
To: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL sequence within function
Date: 2005-07-05 23:05:27
Message-ID: 4a7a73210507051605e424648@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

ahhh... very nice. Thank you.

On 7/5/05, Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com> wrote:
>
> Or upgrade your server to 8.x and use dollar quoting.
> with dollar quoting all that is a thing of the past.
>
> CREATE FUNCTION sp_slide_create(int4) RETURNS int4 AS
> $$
> DECLARE
> aScriptID ALIAS FOR $1;
> seqID int4 := nextval('genseq'); -- no magic needed with dollar qouting
> :-)
> BEGIN
>
> INSERT INTO tblslides (slideid) VALUES (seqID);
>
> RETURN seqID;
>
> END;
> $$
> LANGUAGE 'plpgsql' VOLATILE
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-07-05 23:10:14 Re: Custom C function shutdown-signaling
Previous Message Otto Blomqvist 2005-07-05 22:22:24 Custom C function shutdown-signaling