可能這就是Oracle的work_days函數的算法吧
Calculating Working Days Without Using a Function
This tip comes from Mike Selvaggio
If you need to calculate working days between two dates and you can
SQL> set linesize
SQL> desc date_test
Name Null? Type
START_DT DATE
END_DT DATE
SQL> select * from date_test
SQL> /
START_DT END_DT
SQL> select start_dt
work_days(start_dt
START_DT END_DT AGE WORK_DAYS(START_DT
SQL> get workingdays
代碼
select start_dt
(trunc(end_dt
(case
WHEN (
THEN
ELSE
trunc( (trunc(end_dt
(case
WHEN mod(
THEN
ELSE
trunc( (trunc(end_dt
END) ) ) workingdays
from date_test
SQL> /
START_DT END_DT AGE WORKINGDAYS
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19526.html