Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: help with cursors

Re: help with cursors

From: Ben Graham <bengraham_at_xsmail.com>
Date: 17 Sep 2004 07:40:24 -0700
Message-ID: <f858471c.0409170640.20b57b83@posting.google.com>


"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;

end; Received on Fri Sep 17 2004 - 09:40:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US