Ayuda con una funcion SQL

From: "Juan Carlos Badillo Goy" <badillo(at)cav(dot)desoft(dot)cu>
To: <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Ayuda con una funcion SQL
Date: 2008-06-20 20:57:42
Message-ID: 005501c8d318$48399bf0$c901c0c0@cav.desoft.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Ahora estoy tratando de hacer que una función me retorne lo siguiente: (la
suma o union por asi decirlo de rs_tabla_1 y rs_tabla_2 )

CREATE OR REPLACE FUNCTION "public"."funct_resultante" (aid_usuario integer)
RETURNS SETOF "public"."tabla_1" AS
$body$
declare rs_tabla_1 tabla_1%rowtype;
declare rs_tabla_2 tabla_1%rowtype;
begin

for rs_tabla_1 in
select * from rs_tabla_1 where propietario = aid_usuario and
(tipo = 2 or tipo = 7)
loop
return next rs_tabla_1;
end loop;

for rs_tabla_2 in
select * from rs_tabla_2 where propietario = aid_usuario and tipo
= 9
loop
return next rs_tabla_2;
end loop;

return;
end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Arturo Munive [pgsql-es-ayuda] 2008-06-21 00:57:35 Duda en necesidad de bloquear tablas
Previous Message Juan Carlos Badillo Goy 2008-06-20 20:55:42 Re: Ayuda con una sentencia SQL