From: | Jaime Casanova <systemguards(at)gmail(dot)com> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | PostgreSQL pg-general List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: out parameters and SETOF |
Date: | 2006-01-20 13:05:16 |
Message-ID: | c2d9e70e0601200505r31e0cb22kc659f865d8d734df@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 1/19/06, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
> On Thu, Jan 19, 2006 at 04:03:41PM -0500, Jaime Casanova wrote:
> > there is a way to use OUT parameters in conjunction with SETOF?
>
> Do you want to return a set of the OUT parameters or a set of
> something else? I don't think you can do the latter; for the former
> use SETOF record:
>
> CREATE FUNCTION foo(OUT x integer, OUT y integer)
> RETURNS SETOF record AS $$
> BEGIN
> x := 1; y := 2; RETURN NEXT;
> x := 3; y := 4; RETURN NEXT;
> x := 4; y := 5; RETURN NEXT;
> END;
> $$ LANGUAGE plpgsql;
>
> SELECT * FROM foo();
> x | y
> ---+---
> 1 | 2
> 3 | 4
> 4 | 5
> (3 rows)
>
> --
> Michael Fuhr
>
ok, thanks
--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)
From | Date | Subject | |
---|---|---|---|
Next Message | Sebastjan Trepca | 2006-01-20 13:19:38 | How to fetch rows with multiple values |
Previous Message | Csaba Nagy | 2006-01-20 13:03:05 | autovacuum and temporary tables |