Creating dates between two dates

I need to create all dates between two given dates. This works fine as long as there is only one date range. However, if I have multiple date ranges, this solution does not work. I searched here as well as on asktom, but could not find the appropriate pointers / solution.

I tried both solutions using all_objects and CONNECT BY ROWNUM, but no luck. Here is the problem description: sqlfiddle

Enter

ID START_DATE END_DATE 101 April, 01 2013 April, 10 2013 102 May, 10 2013 May, 12 2013 

Output

 ID Dates 101 April, 01 2013 101 April, 02 2013 101 April, 03 2013 101 April, 04 2013 101 April, 05 2013 101 April, 06 2013 101 April, 07 2013 101 April, 08 2013 101 April, 09 2013 101 April, 10 2013 102 May, 10 2013 102 May, 11 2013 102 May, 12 2013 
+6
source share
3 answers
 select A.ID, A.START_DATE+delta dt from t_dates A, ( select level-1 as delta from dual connect by level-1 <= ( select max(end_date - start_date) from t_dates ) ) where A.START_DATE+delta <= A.end_date order by 1, 2 
+6
source

Try:

 select distinct ID, START_DATE+level-1 DATES from dual a, TABLE_DATES b connect by level <= (END_DATE-START_DATE)+1 order by ID; 
+3
source
  select g.cycle_dt from (select to_date(d,'DD-MM-YYYY') cycle_dt from dual model dimension by (trunc(to_date('30092015', 'DDMMYYYY')) d) measures (0 y) rules ( y[for d from trunc(to_date('30092015', 'DDMMYYYY')) to to_date('30102015', 'DDMMYYYY') increment 1]=0 )) g order by g.cycle_dt; 
+1
source

Source: https://habr.com/ru/post/943592/


All Articles