oracle 12c – Plsql query to split data based on startdate and end date

I want to split data based on start ,end date ,date range configured (yearly/monthly/weekly/quarterly)

For example if the

Startdate is 2015/10/02 and the

Enddate is 2015/12/22

and my date range is Monthly (M)

then my required output is:

Newstartdate newEnddate
2015/10/02.   2015/10/31
2015/11/01.   2015/11/30
2015/12/01.   2015/12/30

So I was looking for a generic PL/SQL query to split data what ever date range can be(Y/Q/M/W/D) based on the start and end dates and the range specification.