-- 공휴일만 따로 관리하는 것 보다는 전체 날짜를 가지고 속성으로 평일,공휴일을 가지는 -- copy_ymd 테이블을 가져가시는게 효율적이라 생각됩니다. -- 아래는 인위적으로 copy_ymd를 만들어서 해결한 방법입니다. -- 재귀호출이나 모델절로도 가능하겠네요 with t as ( select to_char(to_date('20140901','yyyymmdd') + level ,'yyyymmdd') n_day from dual connect by level <= 365 ) , h as ( select '20140901' h_day from dual union all select '20140902' h_day from dual union all select '20140903' h_day from dual union all select '20140908' h_day from dual union all select '20140909' h_day from dual union all select '20140910' h_day from dual ) select max(n_day) from ( select n_day,nvl2(h_day,'H','A') status from t,h where t.n_day = h.h_day(+) order by n_day ) where status = 'A' and rownum <= 7