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

Home -> Community -> Usenet -> c.d.o.server -> Re: Working days

Re: Working days

From: Monty <mmontreaux_at_hotmail.com>
Date: 12 Apr 2003 01:51:01 -0700
Message-ID: <6284dd3.0304120051.732ab07a@posting.google.com>


Kenneth, many thanks. I didn't give the full story in my original posting :(

I want to add a variable number of days, not always 3. Ie I want to add 3 days, 6 days, 7 days, 9 days etc - it will be different every time. I was wanting it generic where I could just put the number of days into the SQL string & spit out the result. Your solution is perfect for 3 days, which is what I asked for, but not for other numbers of days.

Can someone elaborate on how to make it generic.

Help
Monty.

Kenneth Koenraadt wrote in message news:<3e95b158.6044681_at_news.inet.tele.dk>...
> On 10 Apr 2003 09:56:13 -0700, mmontreaux_at_hotmail.com (Monty) wrote:
>
> >Hi, can someone help me with a SQL query to calculate the date which
> >is todays date+3 non-weekend days, ie monday 01 jan+3=thursday 04 jan,
> >tuesday 02 jan+3=friday 05 jan, wednesday 03 jan+3=monday 08 jan,
> >thursday 04 jan+3=tuesday 09 jan, friday 05 jan+3=wednesday 10 jan,
> >saturday 06+3=wednesday 10 jan, sunday+3=wednesday 10 jan.
> >
> >Thank you
> >Monty
>
> Hi Monty,
>
> This is one of about a dozen ways to do it :
>
>
> select sysdate + (case when to_char(sysdate,'D') in ('1','2','7')
> then 3 when to_char(sysdate,'D') in ('3','4','5') then 5 else 4 end )
> from dual;
>
> If you are running 9i, you may also consider the EXTRACT date
> function.
>
>
> - Kenneth Koenraadt
Received on Sat Apr 12 2003 - 03:51:01 CDT

Original text of this message

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