while loop
i have the following data in a table
current date months days
5/4/2006 3 0
3/2/2006 0 300
4/5/2006 10 0
i have the following code in a procedure. basically it will loop until current date is greater than 5/01/2008
if months = 0 then it will add days to the current date. if not it will add months as per the data above.
how can dothis while loop in a query.
WHILE lv_current_date <=to_date('5/01/2008')
LOOP
l_date := lv_current_date;
IF months = 0 THEN
lv_current_date := lv_date + days ;
ELSE
lv_current_date := ADD_MONTHS(l_date,months) ;
END IF;
END LOOP;