Re: PostgreSQL sequence within function

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

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Otto Blomqvist 2005-07-05 22:22:24 Custom C function shutdown-signaling
Previous Message SCassidy 2005-07-05 22:20:27 Re: double entries into database when using IE