Thursday, January 12, 2012

holiday table

Today am writing about the holiday table needed in the organization

This is useful when we have to find the next business date/previous business date  before/after any given business date

create table public_holiday (holidays date)

insert only the holiday dates in this table.

if we need to find the previous business date

fn_nextbusinessdate(v_date)
loop
     check if the day is monday
         then day =day -3
     else day =day -1

  check if the day is holiday in the holiday table then repeat the above process
else exit the loop
loop


now extend the table and function based on our imagination







No comments: