工作日函数

create or replace function func_getHolidayNum(start_date date,end_date date)

  return number is
  /************************************************************
    用途:返回时间段工作日数目的函数,不计入第一天
    创建日期:2016-11-23
    作者:upaths
  ************************************************************/
  r_v   number;
  v_n   number(38, 3);
  v_wek number;
  
begin
  select end_date - start_date into v_n from dual;
  select count(dt_time)
    into v_wek
    from (select start_date + level - 1 dt_time
            from dual
          connect by level <= end_date - start_date + 1)
   where to_char(dt_time, 'd') in ('1', '7');
  r_v := trunc(v_n) - v_wek;
  return r_v;
end;```

标题:获取工作日的函数
作者:upaths
地址:http://noyil.com/getHolidayNum