Originally posted by slimdave
[B]There is the issue that the two methodologies give different results, also ...
Code:
alter session set nls_date_format = 'DD-Mon-YYYY Day';
...
It looks like working_days has a bug.
No, not realy. You've got those results because you have different NLS settings than I do. I've specifficaly mentioned that the whole thing depends on the NLS_TERRITORY settings. The numbering of days if the week in America is different than it is in Europe, for example. So if you have NLS_TERRITORY set to "America", you either need to execute another alter session statement to set different territory, e.g.:

alter session set nls_territory = 'UNITED KINGDOM';

or you would have to modify the usage of the DECODE(day, ...) inside the function from
Code:
...
  SELECT SUM(DECODE(DAY, '7', 0, '6', 0, 1))
...
to
Code:
...
  SELECT SUM(DECODE(DAY, '7', 0, '1', 0, 1))
...