Tricky date range calculations - another look.

From: Steve Frampton <frampton_at_vicuna.ocunix.on.ca>
Date: 8 Jun 94 17:37:31 GMT
Message-ID: <954LNc1w165w_at_vicuna.ocunix.on.ca>


Hello:

A short time ago I asked for advice on calculating the number of working days between two given dates, taking into account non-working days such as weekends as well as statutory and other holidays which would be grabbed from a NON_WORKING_DAYS table.

The net.consensus was to throw all my non-working days, including Saturdays & Sundays into the NON_WORKING_DAYS table and then doing some simple arithmetic.

Although the net.consensus seems to be a good solution, maintaining this table is a human process and asking the clerks to keep track of weekends is pretty rude. :-) One person suggested populating the table automatically and provided a PL/SQL script to do so.

Therefore I have decided:

  • The best solution is to create a temporary table, fill it with my Saturday/Sundays, and then I can do a join with my NON_WORKING_DAYS table, do my thing, and then drop the temporary table.
  • This means my NON_WORKING_DAYS table contains only the relevant holiday and non-working day data reducing the workload for clerical staff.

However, this brings up the following issues:

  • The provided script would fill the table and return the values for the two given dates...however I think this would be slower than just doing the calculation once for a wide range (say, 2 years past to 2 years future) and then doing the math. (Is this pratical?)
  • I need to do this from both SQL and from RPT/RPF.
  • I need a way to generate a UNIQUE temporary table name as this thing will be used by anywhere up to 30 users at a time!
  • I've never used PL/SQL before and hence I don't know exactly how to use the code as provided. :-}
  • I'm a weaselly end-user and hence I don't have ready access to the manuals so please, avoid "RTFM" responses at all costs. :-)

Any information would be appreciated immensely.

Thanks in advance!

---< MAKE MONEY FAST! Contact Dave Rhodes for details. >--- Steve Frampton E-mail: <frampton_at_vicuna.ocunix.on.ca> Received on Wed Jun 08 1994 - 19:37:31 CEST

Original text of this message