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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

while loop

elmasduroMay 4 2009 — edited May 5 2009
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;
This post has been answered by Frank Kulash on May 4 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 2 2009
Added on May 4 2009
8 comments
821 views