It seems to me that a list of non-working days is doing you no favours here -- what you really need is a list of working days (you could do this dynamically of course by minus'ing your non-working days from a list of all days, but it wouldn't perform as well of course).
Anyway, if you had such a list then you could do the following ...
So this would find the date in the table that is 10 rows after the 01-mar-2004, when ordered by dateCode:create table date_work ( date_of_day date primary key ) /Select lead_date From ( Select date_of_day, lead(date_of_day,10) Over (Order By date_of_day) lead_date From date_work where date_of_day >= '01-mar-2004' ) Where date_of_day = '01-mar-2004' /




Reply With Quote