Pages

Wednesday, August 24, 2016

Show 7 Days SQL using Connect by level


select to_char((trunc(sysdate, 'DAY') + (level - 1)), 'Day') dy
from   dual
connect by level <= ((sysdate + 7) - sysdate)

or

select to_char((trunc(sysdate, 'DAY') + (level - 1)), 'Day') dy
from   dual
connect by level <= 7

No comments:

Post a Comment