Re: parametros de salida en procedimiento

From: "Carlos Alberto Cianci" <cacianci(at)yahoo(dot)com(dot)ar>
To: "Jaime Casanova" <systemguards(at)gmail(dot)com>
Cc: "Alejandro D(dot) Burne" <alejandro(dot)dburne(at)gmail(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: parametros de salida en procedimiento
Date: 2006-05-24 12:23:48
Message-ID: 001f01c67f2c$eb3d4eb0$0900a8c0@carlos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola Jaime:
Estuve leyendo sobre el ejemplo que me enviaste, pero tenes que especificar
el tipo de registro.
Yo necesito devolver un tipo de registro que no existe (por ej., el
resultado del join de varias tablas). Creo que la única manera de hacerlo es
creando un parámetro tipo out por cada campo que desee devolver (todavía no
intenté hacerlo). Conocés alguna manera de hacerlo?

Gracias

Carlos Cianci

----- Original Message -----
From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Carlos Alberto Cianci" <cacianci(at)yahoo(dot)com(dot)ar>
Cc: "Alejandro D. Burne" <alejandro(dot)dburne(at)gmail(dot)com>;
<pgsql-es-ayuda(at)postgresql(dot)org>
Sent: Tuesday, May 23, 2006 9:34 PM
Subject: Re: [pgsql-es-ayuda] parametros de salida en procedimiento

On 5/23/06, Carlos Alberto Cianci <cacianci(at)yahoo(dot)com(dot)ar> wrote:
>
> Alejandro:
> Muchas gracias. Te hago otra pregunta. Se puede crear un procedimiento que
> te devuelva un conjunto de registros?
>
> Carlos Cianci
> Argentina
>

http://www.postgresql.org/docs/8.1/static/xfunc-sql.html

32.4.5. SQL Functions Returning Sets
CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$
SELECT * FROM foo WHERE fooid = $1;
$$ LANGUAGE SQL;

http://www.postgresql.org/docs/8.1/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING

y en pl/pgsql necesitas usar RETURN NEXT

en los archivos hay varios ejemplos que te pueden servir...

--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

---------------------------(fin del mensaje)---------------------------
TIP 10: visita nuestro canal de IRC #postgresql-es en irc.freenode.net




___________________________________________________________
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2006-05-24 13:00:52 Re: parametros de salida en procedimiento
Previous Message deepthroat 2006-05-24 11:00:29 Re: Duda sobre busqueda de subcadenas