create or replace function fun_workday(startdate in varchar2,
enddate in varchar2)return number
as
TOTALVALUE NUMBER;
begin
select count(*)
into TOTALVALUE
from (select rownum rnum
from all_objects
where rownum <= to_date(enddate, 'yyyy-MM-dd') -
to_date(startdate, 'yyyy-MM-dd') + 1)
where to_char(to_date(startdate, 'yyyy-MM-dd') + rnum - 1, 'D') not in
('1', '7');
return TOTALVALUE;
end;