From: | josue <josue(at)lamundial(dot)hn> |
---|---|
To: | Leonardo Boet Sánchez <boet(at)gtm(dot)tel(dot)etecsa(dot)cu> |
Cc: | pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: Retornando registros desde funcion (pl/pgsql) |
Date: | 2005-03-17 20:24:27 |
Message-ID: | 4239E77B.7060106@lamundial.hn |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Es que solo lo escribi sin probarlo
> Prueba esto:
> CREATE OR REPLACE FUNCTION temp() RETURNS SETOF test AS
> $body$
> declare
> aa test%rowtype;
> begin
> select into aa col from test;
> next;
> return next;
> end;
> $body$
> LANGUAGE 'plpgsql'
Este funciona:
drop function temp();
drop table test;
create table test (i int, ii int);
insert into test values (1,1);
insert into test values (2,1);
insert into test values (3,1);
insert into test values (4,1);
insert into test values (5,1);
CREATE OR REPLACE FUNCTION temp() RETURNS SETOF test AS
$body$
declare
aa test%rowtype;
begin
for aa in select * from test
loop
return next aa;
end loop;
return ;
end;
$body$
LANGUAGE 'plpgsql';
select * from temp();
--
Sinceramente,
Josué Maldonado.
... "Te enamoras de alguien pero ese alguien no se enamora de ti, otras
personas que no te interesan se enamoran de ti."
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Cesar Najera | 2005-03-18 08:50:19 | consulta |
Previous Message | Leonardo Boet Sánchez | 2005-03-17 19:03:29 | RE: Retornando registros desde funcion (pl/pgsql) |