Re: RETURNS TABLE

From: marcelo mendoza <jmarcelo(dot)mendoza(at)gmail(dot)com>
To: "Guillermo E(dot) Villanueva" <guillermovil(at)gmail(dot)com>
Cc: pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: RETURNS TABLE
Date: 2013-02-27 20:13:35
Message-ID: CAPSkOeW=_w_w6j7c5t_sSYnmoHHbD4=a_8-KUxYc_VRT-URg5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

No se si esto te podría ayudar
http://wiki.postgresql.org/wiki/Return_more_than_one_row_of_data_from_PL/pgSQL_functions

El 27 de febrero de 2013 16:59, Guillermo E. Villanueva <
guillermovil(at)gmail(dot)com> escribió:

> Amigos no puedo encontrar ni en la doc oficial ni en google algo muy
> simple, quiero declarar una función de tipo tabla que va a devolver 3 o 4
> datos nada mas en una tabla de una sola columna, esos datos provienen de
> unos cálculos
> Intenté algo así:
> CREATE OR REPLACE FUNCTION mifuncion(parametros) RETURNS table(columna
> integer) AS
> $BODY$
> declare
> li_retorno integer := -1;
> li_retorno_ext integer := -1;
> ...
> ...
>
> begin
> ...
> ...
> columna := li_retorno;
> return next;
> if li_retorno_ext <> -1 then
> columna := li_retorno_ext;
> return next;
> end if;
> end;
> $BODY$
> LANGUAGE plpgsql
>
> Cuando debería devolver dos filas, me devuelve uno solo, estoy seguro que
> esa no es la forma de ir armando fila por fila. Cual sería la forma? Una
> tabla temporal adentro de la función?
> Desde ya muchas gracias
>
> Guillermo Villanueva
>
>

--
Marcelo Mendoza
(0983) 383-752

In response to

  • RETURNS TABLE at 2013-02-27 19:59:11 from Guillermo E. Villanueva

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Juan 2013-02-27 20:19:03 Re: RETURNS TABLE
Previous Message Gilberto Castillo 2013-02-27 20:08:55 Re: RETURNS TABLE