From: | Ranjan Kumar Baisak <rbaisak(at)nyc(dot)yamaha(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Function with Integer array parameter |
Date: | 2007-08-16 15:14:25 |
Message-ID: | 46C469D1.1010707@nyc.yamaha.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Postgres Gurus,
Please suggest me what is wrong with this
function.
This function tries to retrieve set of rows from description table based
on set of ID fields passed as array.
The error, I get is : ERROR: only one AS item needed for language "plpgsql"
CREATE OR REPLACE function get_description_list(integer[]) RETURNS SETOF
type_description AS
'DECLARE
ints_desc_ids ALIAS FOR $1;
desc_rec __i18n.type_description%ROWTYPE;
BEGIN
FOR desc_rec IN
SELECT d_base.id AS description_id,
''en'' AS iso_lang,
''US'' AS iso_country_a2,
0 as description_type_id,
d_base.description_text AS description_text
FROM description AS d_base
WHERE d_base.id in array_to_string(ints_desc_ids alias,',')
LOOP
RETURN NEXT desc_rec;
END LOOP;
RETURN;
END;'
LANGUAGE plpgsql;
From | Date | Subject | |
---|---|---|---|
Next Message | Rainer Bauer | 2007-08-16 15:20:01 | Re: Yet Another COUNT(*)...WHERE...question |
Previous Message | Erik Jones | 2007-08-16 14:48:19 | Re: SELECT ... FOR UPDATE performance costs? alternatives? |