Re: Help with CURSOR question, please?

From: <jejurkar_at_my-dejanews.com>
Date: Fri, 24 Jul 1998 15:52:27 GMT
Message-ID: <6paajr$rv$1_at_nnrp1.dejanews.com>


>
> CURSOR cur1
> IS
> SELECT id
> FROM a
> ORDER BY a.id ASC;
>
> id1 a.id%type;
>
> CURSOR cur2
> IS
> SELECT e, f
> FROM b
> ORDER BY e, f ASC;

You can define the 2nd cursor with a parameter as :  cursor cur2 (id_v a.id%type) is
 select e,f
 from b
 where b.e = id_v
 order by e, f asc;

>
> FOR cur1_rec IN cur1 LOOP
>
> TEXT_IO.PUT_LINE(out_file1, 'more text');
>
> OPEN cur2;

Change this to :

    open cur2(cur1_rec.id);

> LOOP
> FETCH cur2 INTO e1, f1;
>

HTH,
Sameer

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Fri Jul 24 1998 - 17:52:27 CEST

Original text of this message