Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: help with cursors
"Lenny" <non.te_at_la.dico> wrote in message news:<Z%y2d.336761$5D1.14987864_at_news4.tin.it>...
> I'm a newbie with oracle.
> anyone can help me with these cursors?
>
> I'm trying to port some queries written in VBA to oracle.
>
> how can I set the second cursor "passaggi" dynamically
> taking a value from the first cursor?
> (I cannot use just one cursor joining the tables.)
>
> see line:
> where psd_pv = clienti.upv_cod
>
> thanks.
> Luca
>
> cursor clienti is
> select cli_cod, upv_cod, cli_tigi, upv_agg, upv_trd, cli_int, cli_udat,
> upv_aff1
> from vega.clienti,vega.unopv
> where cli_cod = upv_trd
> order by cli_cod;
>
> cursor passaggi is
> select psd_pv, psd_teo,psd_dat, psd_flg, psd_age
> from vega.pasdst
> where psd_pv = clienti.upv_cod and
> psd_dat >= trunc(sysdate-720) and
> psd_dat <= trunc(sysdate) and
> psd_teo > 0
> order by psd_pv, psd_dat;
declare
cursor clienti is
select cli_cod, upv_cod, cli_tigi, upv_agg, upv_trd, cli_int, cli_udat,
upv_aff1
from vega.clienti,vega.unopv
where cli_cod = upv_trd
order by cli_cod;
begin
for clienti_rec in clienti loop for passaggi_rec in passaggi(clienti_rec.upv_cod) loop -- do something here with data in passaggi_rec and clienti_rec end loop; end loop;
![]() |
![]() |