SELECT TO_CHAR(TO_DATE('20110101','yyyyMMdd')+ROWNUM-1
,'yyyyMMdd') DAY_SD FROM DUAL
CONNECT BY ROWNUM<=trunc(to_date('20111231', 'yyyyMMdd')-to_date('20110101', 'yyyyMMdd'))+1
SELECT TO_CHAR(TO_DATE('20110101','yyyyMMdd')+ROWNUM-1
,'yyyyMMdd') DAY_SD FROM DUAL
CONNECT BY ROWNUM<=trunc(to_date('20111231', 'yyyyMMdd')-to_date('20110101', 'yyyyMMdd'))+1