No matter how you slice it it's too much stuff for such a simple
concept. Here's another slice with TOO much stuff:

select case when next_day(round(sysdate,'MM'),'WEDNESDAY') < sysdate
              or round(trunc(sysdate,'MM'),'W') 
                 = NEXT_DAY(TRUNC(sysdate,'MM')-1,'WEDNESDAY')
            then next_day(round(sysdate+16,'MM'),'WEDNESDAY') 
            else next_day(round(sysdate,'MM'),'WEDNESDAY')
       end 
from dual;


Steve Orr


-----Original Message-----
Sent: Tuesday, July 22, 2003 3:59 PM
To: Multiple recipients of list ORACLE-L


This should fix the flaw:

select CASE WHEN to_char(to_date('09/04/2003','MM/DD/YYYY'), 'DD') <= 6
            THEN CASE WHEN to_char(to_date('09/04/2003','MM/DD/YYYY'),
'DY') = 'WED'
                      THEN to_date('09/04/2003', 'MM/DD/YYYY')
                      ELSE CASE WHEN
to_char(next_day(to_date('09/04/2003', 'MM/DD/YYYY'), 'WED'), 'DD') > 6
                                THEN
next_day(last_day(to_date('09/04/2003','MM/DD/YYYY')),'WED')
                                ELSE next_day(to_date('09/04/2003',
'MM/DD/YYYY'), 'WED')
                           END
                 END
            ELSE
next_day(last_day(to_date('09/04/2003','MM/DD/YYYY')),'WED')
       END
from dual;


Igor Neyman, OCP DBA
[EMAIL PROTECTED]



-----Original Message-----
Daniel Fink
Sent: Tuesday, July 22, 2003 4:04 PM
To: Multiple recipients of list ORACLE-L

Jared,
        If you will closely examine the specs, the assumption is not
documented. Therefore, the application code must take into account that
the 1st Wednesday of the month may still be in the future.

select CASE WHEN to_char(to_date('08/07/2003','MM/DD/YYYY'), 'DD') <= 6
            THEN CASE WHEN to_char(to_date('08/07/2003','MM/DD/YYYY'),
'DY') = 'WED'
                      THEN to_date('08/07/2003', 'MM/DD/YYYY')
                      ELSE next_day(to_date('08/07/2003', 'MM/DD/YYYY'),
'WED')
                 END
            ELSE
next_day(last_day(to_date('08/07/2003','MM/DD/YYYY')),'WED')
       END
from dual;

        Of course, there is a flaw in this logic. Can anyone spot it?
It's particularly nasty...

Daniel

[EMAIL PROTECTED] wrote:
> 
> Rachel,
> 
> The assumption is that the current day is already >= the first
wednesday
> of the month,
> making it useful for the dbms_job interval.
> 
> Did you read the specs?  :)
> 
> Jared
> 
> Rachel Carmichael <[EMAIL PROTECTED]>
> Sent by: [EMAIL PROTECTED]
>  07/22/2003 01:14 PM
>  Please respond to ORACLE-L
> 
> 
>         To:     Multiple recipients of list ORACLE-L
<[EMAIL PROTECTED]>
>         cc:
>         Subject:        RE: Job to run first Wednesday
> 
> don't rush off to use it..... I tried it, substituting August 1 and
got
> September.
> 
>   1* select
> next_day(last_day(to_date('08/01/2003','MM/DD/YYYY')),'WED') from dual
> SQL> /
> 
> NEXT_DAY(
> ---------
> 03-SEP-03
> 
> --- [EMAIL PROTECTED] wrote:
> > Hmm... much more elegant than mine, and everyone elses.
> >
> > Guess I better RTFM the next_day function.
> >
> >
> >
> >
> >
> >
> > "Mercadante, Thomas F" <[EMAIL PROTECTED]>
> > Sent by: [EMAIL PROTECTED]
> >  07/22/2003 12:34 PM
> >  Please respond to ORACLE-L
> >
> >
> >         To:     Multiple recipients of list ORACLE-L
> > <[EMAIL PROTECTED]>
> >         cc:
> >         Subject:        RE: Job to run first Wednesday
> >
> >
> > Josh,
> >
> > With the following functions, you could probably get it to work:
> >
> > select next_day(last_Day(sysdate),'WED') from dual
> >
> > This (today) returns Wed, August 6th.
> >
> > Tom Mercadante
> > Oracle Certified Professional
> >
> >
> > -----Original Message-----
> > Sent: Tuesday, July 22, 2003 3:14 PM
> > To: Multiple recipients of list ORACLE-L
> >
> >
> > Greetings,
> >
> > How can I set the interval in my dbms job to have it run on the
first
> > Wednesday of every month? Is this even possible? I have been trying 
> > to noodle it thru for a week to no avail.
> >
> > tia,
> >
> > Josh
> > --
> > Please see the official ORACLE-L FAQ: http://www.orafaq.net
> > --
> > Author: Josh Collier
> >   INET: [EMAIL PROTECTED]
> >
> > Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> > San Diego, California        -- Mailing list and web hosting
services
> >
---------------------------------------------------------------------
> > To REMOVE yourself from this mailing list, send an E-Mail message
> > to: [EMAIL PROTECTED] (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.net
> > --
> > Author: Mercadante, Thomas F
> >   INET: [EMAIL PROTECTED]
> >
> > Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> > San Diego, California        -- Mailing list and web hosting
services
> >
---------------------------------------------------------------------
> > To REMOVE yourself from this mailing list, send an E-Mail message
> > to: [EMAIL PROTECTED] (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.net
> > --
> > Author:
> >   INET: [EMAIL PROTECTED]
> >
> > Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> > San Diego, California        -- Mailing list and web hosting
services
> >
---------------------------------------------------------------------
> > To REMOVE yourself from this mailing list, send an E-Mail message
> > to: [EMAIL PROTECTED] (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).
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software 
> http://sitebuilder.yahoo.com
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Rachel Carmichael
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (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.net
> --
> Author:
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (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.net
-- 
Author: Igor Neyman
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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.net
-- 
Author: Orr, Steve
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).

Reply via email to