Oracle: generate days between two date

 In Oracle, if you want to generate the days between two date, use :

select 

  to_char (to_date('2011-01-01','YYYY-MM-DD') 

  + rownum -1, 'YYYY-MM-DD')

from all_objects

where 

rownum <= to_date('2011-01-31','YYYY-MM-DD') - to_date('2011-01-01','YYYY-MM-DD') + 1

the ouput is:

2011-01-01

2011-01-02

2011-01-03

................

2011-01-31

 

Comments

Post new comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.