Creating a PL/pgSQL function that returns multiple out parameters and refcursor

From: Néstor Boscán <nestorjb(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Creating a PL/pgSQL function that returns multiple out parameters and refcursor
Date: 2014-10-02 16:15:46
Message-ID: CALyLaQ+PcYnGVhaesdKVJt5PRA6Ma0QuYbPjzJyhujvT-QZHOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

Ho do I create a PL/pgSQL function that returns multiple out parameters and
a refcursor. Something like this:

create function myfunction(p_cursor out refcursor, p_code out varchar,
p_message out varchar) returns record as $$
begin
open p_cursor is select * from table;

p_code := 'OK';
p_message := 'message';

return ???
end;
$$ language plpgsql;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message José Luis Rando Calvo 2014-10-02 17:08:10 Re: Postgres tcp_keepalive_xxxx parameters.
Previous Message Tom Lane 2014-10-02 16:13:33 Re: Getting my Database name in a C Extension