Re: PostgreSQL sequence within function

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

Try this version of your function.
I don't think you can assign a value to a variable in the declaration
section with the return value of a function.

CREATE OR REPLACE FUNCTION sp_slide_create(int4, bool, bool, bool,
varchar, text, varchar, varchar, int4)
RETURNS int4 AS'
DECLARE
aScriptID ALIAS FOR $1;
aAllowDGP ALIAS FOR $2;
aAllowDGO ALIAS FOR $3;
aWaitForSlideFinish ALIAS FOR $4;
aTitle ALIAS FOR $5;
aText ALIAS FOR $6;
aFlashFileDGP ALIAS FOR $7;
aFlashFileDGO ALIAS FOR $8;
aSlideType ALIAS FOR $9;
seqID int4;
BEGIN
seqID = nextval("seqslideid");
INSERT INTO tblslides
(slideid, scriptID, allowdgp, allowdgo, waitforslidefinish, title,
text, flashfiledgp, flashfiledgo, slidetype)
VALUES
(seqID, aScriptID, aAllowDGP, aAllowDGO, aWaitForSlideFinish, aTitle,
aText, aFlashFileDGP, aFlashFileDGO, aSlideType);

RETURN seqID;
END;'

LANGUAGE 'plpgsql' VOLATILE;

Clark Allan wrote:

> Thanks for the help Tony,
> But im still having some trouble.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Hayward 2005-07-05 19:15:01 current_user inside SECURITY DEFINER function?
Previous Message Clark Allan 2005-07-05 18:27:53 Re: PostgreSQL sequence within function