From: | "Gohil, Hemant" <HGohil(at)dylt(dot)com> |
---|---|
To: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | returning result set |
Date: | 2008-09-22 21:40:09 |
Message-ID: | A094C51321D00949B7A791E1AA7CFCC2116EA2B9@lbcamx01.corp.dylt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi,
I am very new to PostgerSQL and trying to create following function and
return the result set back.
For some reason I am not getting following error.
ERROR: a column definition list is required for functions returning
"record"
This function could return multiple rows.
Any pointers to specific solution will also be appreciated.
Thanks
HG
========================================================
CREATE FUNCTION function1(integer) RETURNS SETOF record AS $$
DECLARE
acodes RECORD;
BEGIN
FOR acodes in
SELECT
case
when $1 = a.col1 then
'******'
else ''
end AS "firstColumn" ,
a.col1,
a.col2
a.col3,
a.col6
FROM table1 a INNER JOIN table2 b ON a.col2 = b.col2
WHERE a.col2 in
(
SELECT col2
FROM table1
WHERE col1 = $1
)
ORDER BY codeId LOOP
return next acodes;
END LOOP;
END;
$$ LANGUAGE plpgsql;
========================================================
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma | 2008-09-22 22:12:54 | Re: returning result set |
Previous Message | Maciek Sakrejda | 2008-09-22 20:33:05 | Re: COPY support in JDBC driver? |