Search Postgresql Archives

Re: PostgreSQL sequence within function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux