Created
January 12, 2011 20:38
-
-
Save edsono/776828 to your computer and use it in GitHub Desktop.
Generate DATE values for a year (2012 in example below) in Oracle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT level n, TO_DATE('1/1/' || '2012','DD/MM/YYYY') - 1 + NUMTODSINTERVAL(level,'day') as data | |
FROM dual | |
WHERE TO_CHAR(TO_DATE('1/1/' || '2012','DD/MM/YYYY') - 1 + NUMTODSINTERVAL(level,'day'), 'YYYY') = '2012' | |
CONNECT BY LEVEL <= 366 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment