From: | Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com> |
---|---|
To: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | 8.1 OUT params returning more than one row question |
Date: | 2005-08-31 16:27:39 |
Message-ID: | 4315DA7B.7060503@amsoftwaredesign.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I have been playing around with 8.1(it's very nice by the way) and was
trying to get OUT params to return more than 1 row.
I came up with the function below, and it does work, however I had to
declare another record to use in the FOR ..IN loop.
From my reading of the docs the out params create a record type
automaticly and my question is how can I use this automaticly created
record in the
FOR loop? It does not seem right that I have to create another record
type and then copy the row values to the out parms.
CREATE OR REPLACE FUNCTION test_func9(out firstname varchar, out
lastname varchar)
RETURNS SETOF record AS
$BODY$
Declare
row record;
BEGIN
for row in select null,description from common.common_groups
loop
firstname = row.description;
lastname = '';
RETURN NEXT;
end loop;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
Thanks,
Tony
From | Date | Subject | |
---|---|---|---|
Next Message | Tony Caduto | 2005-08-31 16:39:48 | 8.1 and syntax checking at create time |
Previous Message | Tom Lane | 2005-08-31 16:23:04 | Re: Pre-allocated free space for row |