Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: weekends/holidays

Re: weekends/holidays

From: Don Granaman <granaman_at_home.com>
Date: Fri, 05 Oct 2001 10:57:54 -0700
Message-ID: <F001.003A3CAB.20011005111124@fatcity.com>

You could determine "weekend" using a date format:

SQL> select to_char(sysdate, 'DAY') from dual;

TO_CHAR(S



FRIDAY This could be used in SQL (CASE or DECODE statement) or a simple function.

Determining a "holiday" is much more ambiguous since the definition varies from one nation to another and from one company to another (is Valentine's day a holiday? What about the day after Thanksgiving? ...). For example, in the US, there are 9 stock market holidays, 12 federal holidays (I think), but most companies recognize only 6. What is typically done is to create some context-specific HOLIDAY table, populated it manually, and write code. Context-specific holiday determination could be automated only in code, but the logic would be rather complex and hardly worth the time. Besides, which would you rather routinely update, even if infrequently - data or code?

-Don Granaman
[OraSaurus - Honk if you remember UFI!]

> Hi list,
> Is there a function in Oracle that will determine if particular calendar day
> is weekend or a US holiday. I need to write a function that will check the
> data integrity of my db. It will check data entered into the system and
> notice any gaps. I have to go by days(i.e. every day there should be an
> entry/ies unless it is a weekend or holiday.)
> Thank you in advance,
>
> Lyuda Hoska
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author:
> INET: lhoska_at_calibresys.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Don Granaman
  INET: granaman_at_home.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Oct 05 2001 - 12:57:54 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US