0

I want that procedure to insert the next dates eg today is 1 jan 2016 I want to add 3 months to 1st jan 2016 and store the new dates in a table till end date 1-Feb-2017

startdate:1-01-2016
next date:1-04-2016,1-07-2016,1-10-2016,1-01-2017
enddate:1-Feb-2017

Martin Schapendonk
  • 12,893
  • 3
  • 19
  • 24
SHILPA
  • 1
  • 1
  • 1
    Have you tried googling for this? There are a *lot* of results on how to generate a date range, and a lot of duplicate questions for each of the databases you tagged. – Panagiotis Kanavos Jun 16 '16 at 09:49
  • 1
    Possible duplicate of [Generate a resultset of incrementing dates in TSQL](http://stackoverflow.com/questions/1478951/generate-a-resultset-of-incrementing-dates-in-tsql) – Chris Pickford Jun 16 '16 at 09:50
  • 3
    Why tag spam? In your question title you say plsql and then proceed to add a tag for every known sql database engine? – Alex Jun 16 '16 at 09:56

1 Answers1

0

Here is the query that will get you going:

select add_months(to_date('01012016', 'DDMMYYYY'),  level - 1)
from dual
connect by add_months(to_date('01012016', 'DDMMYYYY'),  level - 1) <= to_date('01022017', 'DDMMYYYY');
Martin Schapendonk
  • 12,893
  • 3
  • 19
  • 24