| From: | Alvaro Herrera <alvherre(at)surnet(dot)cl> | 
|---|---|
| To: | Camilo Ismael Felipe Panadeiros <cfelipe(at)cav(dot)desoft(dot)cu> | 
| Cc: | foro de postgresql <pgsql-es-ayuda(at)postgresql(dot)org> | 
| Subject: | Re: duda sobre programacion en postgre | 
| Date: | 2005-07-04 14:29:38 | 
| Message-ID: | 20050704142938.GB12062@alvh.no-ip.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-es-ayuda | 
On Sun, Jul 03, 2005 at 09:35:09PM +0200, Camilo Ismael Felipe Panadeiros wrote:
> como puedo yo hacer funcionar un ciclo dentro de otro en plpgsql, miren 
> el siguiente fragmento de codigo
> 
> begin
> for rs_tabla1 in
>  select * from a where tabla1.campo1 = "algo"
> loop
>  for rs_tabla2 in
>     select * from tabla2 where tabla2.llave_extranjera = 
> rs_tabla1.llave and tabla2.campo1 = "algo"
>  loop
>      return  next  rs_tabla2;
>  end loop;
> end loop;
> return;
> end;
Por que no haces un JOIN entre las dos tablas mejor?
> el plpgsql me da un error sin sentido, es como si pusiera los campos que 
> le corresponden al rs_tabla2 como parte del rs_tabla1 tambien... 
> entonces mezcla los campos etc, que debo hacer?
Veamos tu error sin sentido, a ver si le podemos extraer sentido.
-- 
Alvaro Herrera (<alvherre[a]surnet.cl>)
"Oh, great altar of passive entertainment, bestow upon me thy discordant images
at such speed as to render linear thought impossible" (Calvin a la TV)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Paùl espin Huayamabe | 2005-07-04 15:15:36 | ayuda... | 
| Previous Message | Martín Marqués | 2005-07-03 22:11:13 | Re: darme de baja |