Pages

Monday, November 26, 2018

Query to Weekend Dates Between Two Input Dates in Oracle

select
dt date,
to_char(TO_DATE(dt), 'DY') day
from (select
trunc(TO_DATE(:DATE_FROM)) + level - 1 dt
           from dual
     connect by trunc(TO_DATE(:DATE_FROM)) + level - 1 <= trunc(TO_DATE(:DATE_TO))
          )
where to_char(TO_DATE(dt), 'DY') in ('SAT','SUN')

No comments:

Post a Comment