mil gracias, Álvaro lo voy a probar ks
----- Original Message ----- From: "Alvaro Herrera" <[EMAIL PROTECTED]> To: "bajopalabra.ar" <[EMAIL PROTECTED]> Cc: <pgsql-es-ayuda@postgresql.org> Sent: Friday, October 17, 2008 12:01 PM Subject: Re: [pgsql-es-ayuda] existen stored procedures? > bajopalabra.ar escribió: > > > el tema de la devolución de varios lotes > > de última, lo puedo llegar a manejar en otra capa > > Puedes retornar SETOF refcursor en una función, y de cada cursor obtener un > resultado diferente. Prueba algo así: > > alvherre=# create or replace function refcursors () returns setof refcursor > language plpgsql as $$ > declare > cursor1 refcursor; > cursor2 refcursor; > begin > open cursor1 for values (1), (2), (3); > return next cursor1; > open cursor2 for values ('foo'), ('bar'), ('baz'); > return next cursor2; > end; > $$ > ; > CREATE FUNCTION > alvherre=# begin; > BEGIN > alvherre=# select * from refcursors(); > refcursors > -------------------- > <unnamed portal 3> > <unnamed portal 4> > (2 filas) > > alvherre=# fetch all from "<unnamed portal 3>"; > column1 > --------- > 1 > 2 > 3 > (3 filas) > > alvherre=# fetch all from "<unnamed portal 4>"; > column1 > --------- > foo > bar > baz > (3 filas) > > alvherre=# commit; > COMMIT > > > -- > Alvaro Herrera http://www.amazon.com/gp/registry/CTMLCN8V17R4 > "In a specialized industrial society, it would be a disaster > to have kids running around loose." (Paul Graham) -- TIP 1: para suscribirte y desuscribirte, visita http://archives.postgresql.org/pgsql-es-ayuda