Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Passing Parameter from one cursor to another

user527356Aug 26 2013 — edited Aug 26 2013

Hi All,

I have two cursor. One is for getting dates for one month and other is for doing some calculations based on date. Both these cursor are parameterized.

When I am trying to get values from them it seems control is not going into second loop (for second cursor). Pls help me to understand the reason.

Below is the code I am using.

Cursor c_date(b_mydate DATE)
----getting dates for month of given date
Cursor c_cal(cont_id VARCHAR2, b_date DATE, c_code VARCAHR2)
---doing SUM of certain columns based on parameters

For c_d1 IN c_date(d_date) LOOP
      d_date := c_d1.dt;
For r_cal IN c_cal(id, date1, code) LOOP
  IF date1< TRUNC(ld_sysdate) THEN
sum := sum + r_cal.act_tot;
ELSEIF ....
---- get another value
....
END IF;
END LOOP;
END LOOP;

I placed dbms_output_put_line in both the loops, it prints value in outer loop but never print anything in inner loop. I am not sure what mistake I am making.

Thanks in advance.

Anil

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2013
Added on Aug 26 2013
3 comments
2,075 views