Oracle: How to get all the months between two dates

select distinct(last_day(to_date(td.end_date + 1 – rownum)))
from all_objects
,(– this is just to easily substitute dates for the example…
select to_date(’30-JAN-2010′) start_date
,to_date(’15-MAR-2011′) end_date
FROM   DUAL  ) td
where trunc(td.end_date + 1 – rownum,’MM’) >= trunc(td.start_date,’MM’)
order by 1;

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *


+ nine = 18