How to view the 3rd working day of each month.

Hello

could someone help me with a proc to display the 3 day working rd of each month?
By day, I mean working Mon - Fri.
Thank you.

Hello

Sorry, I initially responded to the question "what is the * first * work of the month ', which is a little easier.

Here's a way you can code in SQL:

ALTER SESSION     SET NLS_DATE_FORMAT     = 'DD-Mon-YYYY Dy';

WITH     got_dates     AS
(
     SELECT     TRUNC ( ADD_MONTHS (SYSDATE, LEVEL)
                , 'MONTH'
                )     AS a_date
     FROM     dual
     CONNECT BY     LEVEL     <= 12
)
-- The part above just generates some sample dates
-- The part below is the actual query:
--
SELECT    a_date
,       CASE  TO_CHAR ( a_date + 2
                        , 'fmDay'
                  , 'NLS_DATE_LANGUAGE=ENGLISH'     -- If needed
                  )
           WHEN  'Monday'    THEN  4
           WHEN  'Tuesday'     THEN  3
           WHEN  'Saturday'  THEN  4
           WHEN  'Sunday'     THEN  4
                              ELSE  2
       END + a_date     AS third_workday
FROM       got_dates
ORDER BY  a_date
;

Output:

A_DATE            THIRD_WORKDAY
---------------   ---------------
01-Nov-2012 Thu   05-Nov-2012 Mon
01-Dec-2012 Sat   05-Dec-2012 Wed
01-Jan-2013 Tue   03-Jan-2013 Thu
01-Feb-2013 Fri   05-Feb-2013 Tue
01-Mar-2013 Fri   05-Mar-2013 Tue
01-Apr-2013 Mon   03-Apr-2013 Wed
01-May-2013 Wed   03-May-2013 Fri
01-Jun-2013 Sat   05-Jun-2013 Wed
01-Jul-2013 Mon   03-Jul-2013 Wed
01-Aug-2013 Thu   05-Aug-2013 Mon
01-Sep-2013 Sun   04-Sep-2013 Wed
01-Oct-2013 Tue   03-Oct-2013 Thu

Published by: Frank Kulash, October 4, 2012 17:56

Tags: Database

Similar Questions

  • How to get the number of days in a month of belonging to a range of dates

    Hi, I'm going crazy around a problem, I have 2 dates and one month I wanto to retrieve the number of days belonging to the months that fall within the range.

    for example:

    month of January 2011. begin_date = January 11, 2011, May 30, 2011 end_date result is 21
    month of January 2011. begin_date = December 11, 2010, result of end_date, January 10, 2011 10
    month January 2011 .begin_date = 2 February 2011, end_date may 25, 2011 result 0
    month of January 2011. begin_date = January 3, 2011, January 5, 2011 result DATE END 3

    and so on...

    I appreciate any suggestion
    Thank you


    Andrea

    Something like that... ?

    SQL> with t as
      2  (select  to_date('11/01/11','dd/mm/yy') from_dt,
      3           to_date('30/05/11','dd/mm/yy') to_dt,
      4           'Jan-11' mnth from dual)
      5  select least(last_day(to_date(mnth,'Mon-yy')),to_dt) -
      6         greatest(to_date(mnth,'Mon-yy'),from_dt) cnt
      7  from t  ;
    
           CNT
    ----------
            20
    

    If 0 is also expected...

    SQL> with t as
      2  (select  to_date('11/01/11','dd/mm/yy') from_dt,
      3           to_date('30/05/11','dd/mm/yy') to_dt,
      4           'Jan-11' mnth from dual union all
      5           select  to_date('11/01/11','dd/mm/yy') from_dt,
      6           to_date('30/05/11','dd/mm/yy') to_dt,
      7           'Jan-12' mnth from dual
      8           )
      9  select from_dt,to_dt,mnth,
     10         greatest(
     11              least(last_day(to_date(mnth,'Mon-yy')),to_dt)
     12              -
     13              greatest(to_date(mnth,'Mon-yy'),from_dt)
     14                 ,0) cnt
     15  from t;
    
    FROM_DT   TO_DT     MNTH          CNT
    --------- --------- ------ ----------
    11-JAN-11 30-MAY-11 Jan-11         20
    11-JAN-11 30-MAY-11 Jan-12          0
    

    Published by: JAC on February 9, 2012 19:22

  • How can I update the column 1st day of each month

    Hello
    I have an Emp table with the following columns
    1.Emp_name varchar2(50),
    2.Days number(3).
    now it has the following features,
    Emp_name              Days
    Mishra                     11
    David                      15
    Raju                       18
    Now I need to update the column 'Days' 20 for emp_name all whenever the date is the first day of the month
    IE June 1, 2012 July 1, 2012 and so on.
    How can we do?
    can someone help me.
    Thank you.

    Look for the DBMS_SCHEDULER package.

    Kind regards

  • last working day of each week

    Hello world
    Could someone suggest how to configure Oracle 11g Scheduler so that it would start the last working day of each week? The last business day of the week is not always Friday; exceptional days are configured in separate planners, who are included or excluded in clause repeat_interval, (for example).

    The last business day of each month, works well, like this:

    BEGIN
    DBMS_SCHEDULER. () CREATE_SCHEDULE
    schedule_name = > "LAST_SETT_DAY_OF_MONTH"
    repeat_interval = > ' FREQ = MONTHLY; BYHOUR = 18; BYMINUTE = 30; BYDAY IS MON, MAR, SEA, GAME, FRI.; BYSETPOS =-1; EXCLUDE = HOLIDAY; INCLUDE = EXCEPTIONAL_WORKING_DAYS; ") ;
    END;

    But I want to run a similar logic for weeks.

    Thanks in advance

    OK, now I understand your request.
    I think it might be possible for PL/SQL function.
    Create the table suite where you put your nonworking days and the additional working days. To create the PL/SQL function and use

    CREATE TABLE day_list(
    DAY DATE NOT NULL,
    TYPE NUMBER(1) NOT NULL,
    CONSTRAINT pk_day_list PRIMARY KEY(DAY),
    CONSTRAINT ch_day_list_type CHECK(TYPE IN (1,2)));
    -- type 1-nonworking day,2-extra working day
    
    CREATE OR REPLACE FUNCTION last_working_day(p_date IN DATE) RETURN DATE AS
      v_retval DATE := TRUNC(p_date);
      v_aux    DATE;
    BEGIN
      IF v_retval IS NOT NULL
      THEN
        -- get next friday
        dbms_scheduler.evaluate_calendar_string(calendar_string => 'FREQ=DAILY; BYDAY=FRI',start_date => v_retval,return_date_after => v_retval,next_run_date => v_retval);
        -- check if SUNDAY or SATURDAY is extra working day
        SELECT MAX(DAY)
        INTO   v_aux
        FROM day_list
        WHERE TYPE=2
        AND DAY BETWEEN v_retval+1 AND v_retval+2;
        IF v_aux IS NOT NULL
        THEN
          v_retval := v_aux;
        ELSE
          -- find last working day from monday to friday
          WITH v_1 AS (SELECT v_retval - LEVEL +1 AS DAY
                         FROM dual
                         CONNECT BY LEVEL <=5)
          SELECT MAX(DAY)
          INTO   v_aux
          FROM (SELECT v_1.day, CASE WHEN t.type=1 THEN 0 ELSE 1 END is_working_day
                FROM v_1
                LEFT JOIN day_list t ON v_1.day=t.day AND t.type=1
                )
          WHERE is_working_day=1;
          -- there is a working day
          IF v_aux IS NOT NULL
          THEN
            v_retval := v_aux;
          ELSE
            -- go to next week
            v_retval := last_working_day(v_retval);
          END IF;
        END IF;
      END IF;
      RETURN v_retval;
    END;
    /  
    
  • How to view the anticipated date of 3 days bb

    Greetings

    How to view the early date to 3 days with bb.

    I was able to view the current in bb, but can not able to display the date fututre.

    Help, please

    concerning

    Anthony singh

    Hello

    Add 3 days to the current date.

    days3 long = (3 * 24 * 60 * 60 * 1000);   MS

    TimeFormat SimpleDateFormat = new SimpleDateFormat ("YYYY/MM/DD HH: mm: EEE");
    timeString = «"+ timeFormat.formatLocal (System.currentTimeMillis () + Days3);»

    Thank you

    Stephenson

  • How to calculate the number of days/weeks/months between 2 dates?

    Hello

    I would like to know how to calculate the number of days/weeks/months between 2 dates in OBIEE 11 g, for example, I have 26/05/2013 and 19/05/2013, then I want to get 7 days.

    Thank you!
    Jamie

    Hi Jamie,

    Through this links...

    http://www.bravesoft.com/blog/?p=682
    http://twobiee.blogspot.in/2012/01/working-with-date-differences.html

    Mark as correct it allows u...
    Thank you...

  • How to view the settings for the sequence (info that is displayed when you open the first sequence)?

    Hi, I would like to ask how to view the current settings of the sequence, I'm already working the same information that is displayed when you open for the first time a new sequence

    for example.

    General

    Editing mode: QuickTime DV PAL

    Time Base: 25.00fps

    Video settings

    Image size: 720: 576v (1.4587)

    Frame rate: 25.00 FPS

    Format of the pixels: PAL D1/DV widescreen 16:9 (1.4587)

    Fields: Bottom field first

    Audio settings

    Sample rate: 48000 samples/second

    Default sequence

    Total of the video tracks: 3

    Master the track type: stereo

    Audio tracks:

    Audio 1: Standard

    Audio 2: Standard

    Audio 3: Standard

    I forgot what setting I chose for my current sequence and tried to look under project settings , as well as the sequence settings

    but do not show the news that you see when you open a new sequence for the first time, especially if the edit mode is PAL or NTSC etc.

    How can I find this information which my current sequence is on?

    Thank you

    Sequence / sequence of setting you will find all the information.

    If his pal, you're on 25 or 50 fps.

    the rest is ntsc.

  • How to view the report by using the style of calendar in obiee

    Hello
    Can someone tell me how to view the report as the calendar?
    When I choose chrystelle, it displays 31 days. 7 column, from Sunday to Saturday, and each cell displays the detailed information, such as sales from today!
    Thank you!

    Hello

    Please foloww the below blog...

    http://bischool.WordPress.com/2010/10/22/calendar-view-in-OBIEE-and-applications/

    Thank you
    Vincent

  • How to remove the rear work plan in photoshop CS6

    Hello

    I'm trying to find how to remove the rear work plan in photoshop CS6?

    I always looking for the "preference", but I can't find the solution.

    I really prefer to have no background as the CS5 because I always work with "drag & drop" and now, it is impossible to see my office.

    Capture d’écran 2012-03-28 à 11.15.15.png

    Thank you

    Concerning

    You could ask on the cs6 forum, but I think thre an option under window or view to remove the frame of the application.

    http://forums.Adobe.com/community/Labs/photoshopcs6?view=discussions&start=0

    I have a question if you don't mind. What resolution is your screen?

  • How to view the history of the exams?

    I want to know how to make someone look at his history of review?

    801264 wrote:
    OK, this is how you show your certificate. But how to view the history of the review?
    I just spent a few hours ago 1Z0-051. Now, I want to see my own historical review. How can I do this? Via certview, or should I go directly to the website of pearson?

    Published by: 801264 on December 23, 2010 16:34

    Pearson VIEW find out of your exam at Pearson VIEW history... but he will not know about certifications.

    Certiview will be your story for review and certification. Are can be a lag of a few days between information get Pearson view at Certview.

  • How to view the monthly/annual statistics in terms of time past/calories burned, broken down by each individual activity such as run elliptical/outside etc. Y at - it a third party application that can help me to collect and display these data?

    How to view the monthly/annual statistics in terms of time past/calories burned, broken down by each individual activity such as run elliptical/outside etc. Y at - it a third party application that can help me to collect and display these data?

    Hello

    It is not currently possible to review the data the application integrated in activity or training on this basis. If you want Apple to consider adding this feature, you can suggest here:

    https://www.Apple.com/feedback/watch.html

    However, health and fitness data from other sources, iPhone, and Apple Watch are registered and grouped within the health on iPhone app. These data can be exported, which you may find useful to track the cumulative progress and/or analyze your activity more in detail.

    IPhone app activity also has a button for sharing (top right of the screen) that allows to share data - including social media, Messages, Mail, Notes, and a printer.

    Include third-party applications that can be useful, for example:

    Access to QS

    -"Access your HealthKit data in a table so you can Explorer using numbers, Excel, R, or any other tool compatible CSV."

    - https://itunes.apple.com/gb/app/qs-access/id920297614?mt=8

    SpectaRun workouts

    -"View from the workouts of your Apple Watch on your iPhone and to export these workouts so you can download them to your favorite online running community."

    - https://itunes.apple.com/gb/app/spectarun-workouts/id991723862?mt=8

    Data can also be exported directly from the application of the health (Health Data > All - Share at the top button on the right).

    Check the descriptions and support resources for third party applications for supported details of import and data analysis features.

    More information:

    Use the activity on your Apple Watch - Apple Support

    Use of the workout on your Apple Watch - Apple Support

    http://www.Apple.com/watch/health-and-fitness/

  • How to view the PSA screenshot on front panel

    Anyone know how to view the screenshot of the specturm Analyzer the PSA series on the façade. I can put the JPEG file in the C drive, but I can not display on the front panel. Please see my labview code.

    Thank you, very good information

  • How to disable the backup works when you print an email?

    How to disable the backup works when you print an email.  Whenever I try to print an e-mail, save it as a PDF is displayed.  I then have to save, then open the file to print.

    Hello

    Thanks for posting your query on the Microsoft Community.

    To disable this feature, you need to uninstall Adobe reader and then check if still back you the question quickly.

    Kind regards

    Jesinta Rozario

  • How to view the songs that were on the "rocket" using windows Explorer?

    How to view the songs that were on the "rocket" when buying using windows Explorer?

    Do you need the list or do you need knowledge where they are? If you are looking for the list just look for the Board of Directors. If you are looking for them on the "rocket" you must be connected in MTP Mode.

  • How to view the application menu in the app?

    Hi all

    Does anyone know how to view the application menu in the app?
    The ultimate effect is that when you see the user swipe down from the top of the screen, the menu of the application.

    Thank you very much.

    Please check the recent threads or duplicate search before posting questions: http://supportforums.blackberry.com/t5/Cascades-Development/Application-Menus/td-p/1785653

Maybe you are looking for