Home » SQL & PL/SQL » SQL & PL/SQL » pl/sql help
icon5.gif  pl/sql help [message #378392] Tue, 30 December 2008 04:14 Go to next message
sujata.ghatak
Messages: 6
Registered: December 2008
Junior Member
hi all,
Can u please help me out in the following regards....
in a oracle stored procedure, I cannot write a for loop within a while loop.Is it impossible,or there is any other way to do it.
Re: pl/sql help [message #378393 is a reply to message #378392] Tue, 30 December 2008 04:18 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
Quote:
I cannot write a for loop within a while loop


Oh yes, you can!

Have you tried it yourself? If so, did you get any errors?
Re: pl/sql help [message #378394 is a reply to message #378393] Tue, 30 December 2008 04:21 Go to previous messageGo to next message
sujata.ghatak
Messages: 6
Registered: December 2008
Junior Member
Yes I've tried it myself,it doesn't give any error.but when I'm executing the procedure it does nothing...
I'm sending the code below

while (lv_week_end <= lv_month_end) loop 
     for emp_dtl in cur_emp loop
         insert into prl_eiil_weekly_late_min
         (location_id,employee_no,pay_month,pay_year,
          week_no,week_start_date,week_end_date,late_attn_min)
         values   (p_loc,emp_dtl.employee_no,p_month,p_year,lv_week_no,
lv_week_start,lv_week_end,emp_dtl.tot_late);
      end loop;
      lv_week_start := lv_week_end + 1;         
      select min(cal_date)-1 into lv_week_end
       from prl_eiil_holiday_dtl
       where location_id = p_loc
           and holiday_type = 1
           and cal_date >= lv_week_start;
      end loop;
Re: pl/sql help [message #378395 is a reply to message #378394] Tue, 30 December 2008 04:26 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
Looks like a logic problem to me. Try to add some debugging statements to see if it enters the while loop, the for loop, etc. If not, look at the variable values to understand why it didn't.
Re: pl/sql help [message #378402 is a reply to message #378395] Tue, 30 December 2008 05:20 Go to previous message
sujata.ghatak
Messages: 6
Registered: December 2008
Junior Member
it has solved now.thanx for your help.
Previous Topic: Inline Attachment (Mail Triggering)
Next Topic: Updating Records
Goto Forum:
  


Current Time: Sun Dec 11 00:11:42 CST 2016

Total time taken to generate the page: 0.16430 seconds