Re: [SQL] returning setof in plpgsql

2003-01-25 Thread Bruce Momjian
I thought we had an example of this type of function in the docs, but we don't. Here is one: http://www.brasileiro.net:8080/postgres/cookbook/view-recipes.adp?section_id=535&format=long --- Tom Lane wrote: > "Davi

Re: [SQL] returning setof in plpgsql

2003-01-21 Thread Tom Lane
"David Durst" <[EMAIL PROTECTED]> writes: > CREATE FUNCTION lookup_account(varchar(32)) RETURNS SETOF accounts AS ' > DECLARE > aname ALIAS FOR $1; > rec RECORD; > BEGIN > select into rec * from accounts where accountname = aname; > return rec; > END;' > LANGUAGE 'plpgsql'; As written, thi

Re: [SQL] returning setof in plpgsql

2003-01-21 Thread Gary Stainburn
On Tuesday 21 Jan 2003 10:40 am, David Durst wrote: > I have a function that I want to return setof a table in plpgsql. > > Here is what I have: > > CREATE FUNCTION lookup_account(varchar(32)) RETURNS SETOF accounts AS ' > DECLARE > aname ALIAS FOR $1; > rec RECORD; > BEGIN > select into rec

[SQL] returning setof in plpgsql

2003-01-21 Thread David Durst
I have a function that I want to return setof a table in plpgsql. Here is what I have: CREATE FUNCTION lookup_account(varchar(32)) RETURNS SETOF accounts AS ' DECLARE aname ALIAS FOR $1; rec RECORD; BEGIN select into rec * from accounts where accountname = aname; return rec; END;' LANGUAG