[GENERAL] table name as variable within Function

2005-07-07 Thread Clark Allan
Here is an example of what i would like to do...--- CREATE FUNCTION fun_totalrecords(varchar) RETURNS int8 AS'DECLAREtheTable ALIAS FOR $1;result int := 0;BEGIN result = COUNT(*) FROM theTable; -- this is where i need help  RETURN result; END; 'LANGUAGE 'plpgsql'

[GENERAL] ms-sql OUTPUT equivalent

2005-07-06 Thread Clark Allan
Is there an equivelent to the OUTPUT parameter in MS-SQL? here is an example: CREATE PROCEDURE GetPagedList( @CurrentPage   tinyint, @PageSize   tinyint, @TotalRecords   int OUTPUT,)ASSet NoCount On-- ...some code here...-- Return the total number of records

Re: [GENERAL] PostgreSQL sequence within function

2005-07-06 Thread Clark Allan
quot;);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.>

Re: [GENERAL] PostgreSQL sequence within function

2005-07-06 Thread Clark Allan
really mising was a semi colon afer nextval('myseq') andthe begin end.CREATE or REPLACE FUNCTION getSeq() RETURNS int AS$$beginRETURN nextval('myseq');end;$$LANGUAGE 'plpgsql';Clark Allan wrote:>-->CREATE FUNCTION getSeq

Re: [GENERAL] PostgreSQL sequence within function

2005-07-05 Thread Clark Allan
ahhh... very nice. Thank you. On 7/5/05, Tony Caduto <[EMAIL PROTECTED]> 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$$DECLAREaScriptID ALIAS FOR $1;seqID int4 := nextval('gense

[GENERAL] PostgreSQL sequence within function

2005-06-30 Thread Clark Allan
I am new to Postgre, and am still learning some of the basics... please bare with me. I need to know how to access a sequence from within a function. Let me know whats wrong with the following... (this is not the exact function, just for examples sake...) -