From: | "Frank Motzkat/IC3S AG" <frank(dot)motzkat(at)ic3s(dot)de> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | declare function with IN and OUT parameter as well as refcursor |
Date: | 2005-11-24 08:26:07 |
Message-ID: | 002401c5f0d0$b7c2fc00$234011ac@gump.ic3s.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi community,
I would like to declare a function with IN and OUT parameters as well as a refcursor as return value.
For example something like this:
This doesn’t work. It gives the compilation error ‘ERROR: function result type must be integer because of OUT parameters’
CREATE OR REPLACE FUNCTION reffunc2(IN key int, INOUT name int) RETURNS refcursor
AS $$
DECLARE
ref refcursor;
BEGIN
OPEN ref FOR SELECT col FROM test;
RETURN ref;
END;
$$ LANGUAGE plpgsql;
This works …
CREATE OR REPLACE FUNCTION reffunc2(IN key int) RETURNS refcursor
AS $$
DECLARE
ref refcursor;
BEGIN
OPEN ref FOR SELECT col FROM test;
RETURN ref;
END;
$$ LANGUAGE plpgsql;
I’m wondering how I should declare such a function, or isn’t possible at all with postgres 8.1 ? With MS-Sql and Oracle such functions are no problem at all.
Thanks a lot for any reply in advance !
Cheers,
frank
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2005-11-24 08:31:04 | Re: declare function with IN and OUT parameter as well as refcursor |
Previous Message | Richard Huxton | 2005-11-24 08:22:02 | Re: Delete statement does not work with PostgreSQL 8.0.1 |