Oracle: Get Month Start and End Dates for a Given Period (i.e. Year)

Took me a few minutes to think this one through, so I thought I’d share. In this example I show the start and end date for each month in the period that contains the fiscal year from 7/1/10 to 6/30/11. select trunc(add_months(’01-JUL-10′, level-1), ‘MM’) start_date, last_day(add_months(’01-JUL-10′, level-1)) end_date from dual┬áconnect by level <= ceil(months_between(’30-JUN-11′, ’01-JUL-10′)) […]