Today I am going to show you how to list the months and years between two dates interval using Oracle SQL
Select distinct to_char(create_date,'MON-yyyy')as Create_Date from
(
SELECT TO_DATE('10/01/2008', 'MM/dd/YYYY') + rownum as create_date
FROM all_objects
WHERE TO_DATE('10/01/2008', 'MM/dd/YYYY') + rownum <= TO_DATE(to_char(sysdate,'mm/dd/yyyy'),'MM/dd/YYYY') )
Result :
OCT-2008
NOV-2008
DEC-2008
JAN-2009
FEB-2009
No comments:
Post a Comment