Here you go

Thursday, February 13, 2014

Query/SQL Returns Days on Row / Generate a range of dates using SQL in Oracle

The simple and direct answer to this Question is:

select trunc(sysdate, 'YYYY') + (level-1) as the_day
from dual
connect by level <= to_number(to_char(last_day(add_months(trunc(sysdate, 'YYYY'),11)), 'DDD'))

No comments:

Post a Comment

Thanks for making a comment.