Calendar working days


Hello

I have a few packages of oracle I plan in a Linux environment using crontab. Its simple to plan their calendar months however, my requirement is to race the working days of the month. For example on the 1st or the 2nd business day of the month, can anyone suggest the best way around to do this

There is a time dimension in the database that contains an indicator of working_day for each day, that somehow be combined in the crontab Schedule to run only if the 1st of the month is a working day

Cron or dbms_scheduler have any notion of business day, so you can not schedule automatically for the first working day of the month.

What I usually do for this kind of thing, is planning the work to be performed on each of the first days of the month (how much would depend on the biggest race of holidays possible considering your holiday calendar).  The first think that the procedure is to check if it's the first day of work, if so then do the work, if not then stops.

John

Tags: Database

Similar Questions

  • Rules of the calendar showing the same party as a working day

    Hi all

    I use 10.3 OBPM.

    I created a so-called holiday "holi_rule" rule and declared a public holiday set by the user. I created a calendar rule and "holi_rule" as a rule of holiday in the civil rule.

    When I'm putting the code below
    calendarRule = Fuego.Lib.CalendarRule.fetch (calendarName: "India_Calendar_Rule");
    Work date = calendarRule.isWorkDate(time: timeObj.time);
    logMessage ("day of work:"+ work date ");
    Boolean isHoliday = calendarRule.isHoliday(time: timeObj.time);
    logMessage ("holiday is:"+ isHoliday ");
    timeObj.time is an entry I have the purpose of BPM presentation. "
    The two messages appear as true. I don't know why both appear as true. Can someone help me to get the holidays defined by the user as a holiday?

    Thanks in advance

    Neya-

    Hello

    I hope that the timeObj.time you have defined/recovery of presentation is a holiday that you have defined in the vacation rule.

    Accoring to the rule of holiday is a holiday, but according to the working day that you have defined in the calendar of street is also a day of work.
    So you should make use of the logic of the two tests to discover an effective work day

    If (calendarRule.isWorkDate(time: timeObj.time) == false & calendarRule.isHoliday(time: timeObj.time) == true) {}
    Put your logic here
    }

    Sidonie

  • in the cloud? Number of working days derive from timestamp

    Y at - it a connector or an app that can take a DATE (for example 01/10/2012) and calculate the number of working days?

    No, the date calculator is only calendar days, not working days (should be enough culturally fancy that geo had what holiday...).

    The easy solution (but hacky) is to the calendar days * 5/7, bringing the working days... not elegant, but it converges on ~ accurate with many...

  • [10g] Best to fill and update multiple calendars work?

    I would like to create multiple calendars working and be able to update as needed. Each work schedule would be for 5 years at the most (right now), but it is possible that at some point in the future, I might want to extend that.

    A work schedule can be applied to a single resource or group of resources. Each individual belongs to a group of resources. What I think, is that if an individual resource has a calendar of work involved, this calendar is used, but if not, it uses the calendar of its resource group, and if the group does not have one, the default schedule is used. Theoretically, each resource can have its own schedule of work, and there would be probably 500 resources to the maximum. In practice, many resources will have the same or similar work schedules.

    Each calendar will be based on one of the 3 standards: all calendars days are working days, on a daily basis, but weekends are working days, or every day except weekends and holidays are working days. (Weeks begin on Sunday and Saturday and Sunday are weekends). The standard calendar would be then modified to create each unique timing as required. For example, if a resource has been used, their calendar is perhaps the standard of works not on weekends and holidays, but could also include a stay of one week in February and stay for a week in July. I'm not sure what the best approach is to define a calendar in the first place and then be able to update an employee decides to holiday (or any other situation that may affect the working days).

    In addition, I really want to be able to integrate the working hours, which can vary daily, but would probably would be pretty standard. I don't know if this information is part of the work table, or as something separate to be combined with work table.

    My ultimate goal in doing all this is to try to plan a project of great amongst the many resources.

    Some examples of data showing where I am so far:
    CREATE TABLE     work_groups
    (     group_id     VARCHAR2(5)     NOT NULL
    ,     group_name     VARCHAR2(25)     
    ,     group_desc     VARCHAR2(200)
    ,     CONSTRAINT     work_groups_pk     PRIMARY KEY (group_id)
    );
    
    INSERT INTO     work_groups
    VALUES     ('A','Group A','Group A description');
    INSERT INTO     work_groups
    VALUES     ('B','Group B','Group B description');
    INSERT INTO     work_groups
    VALUES     ('C','Group C','Group C description');
    INSERT INTO     work_groups
    VALUES     ('D','Group D','Group D description');
    
    CREATE TABLE     resources
    (     resource_id     VARCHAR2(20)     NOT NULL
    ,     type          VARCHAR2(1)
    ,     description     VARCHAR2(200)
    ,     group_id     VARCHAR2(5)     
    ,     CONSTRAINT     resources_pk     PRIMARY KEY (resource_id)
    ,     CONSTRAINT     group_id_fk     FOREIGN KEY (group_id)
                             REFERENCES  work_groups (group_id)
    );
    
    INSERT INTO     resources
    VALUES     ('A001','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A002','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A003','M','text here','A');
    INSERT INTO     resources
    VALUES     ('B001','M','text here','B');
    INSERT INTO     resources
    VALUES     ('B002','M','text here','B');
    INSERT INTO     resources
    VALUES     ('C001','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C002','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C003','M','text here','C');
    INSERT INTO     resources
    VALUES     ('D001','M','text here','D');
    INSERT INTO     resources
    VALUES     ('12345','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12346','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12347','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12348','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12349','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12350','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12351','L','text here','D');
    I don't know if I should have a separate table to define a relationship between a resource or resource groups and a calendar id (each resource or group would be able to assign 1 calendar unique id, although several resources/groups could share the same schedule id), or if I have to add an additional column to each table above to assign the calendar id.
    CREATE TABLE     calendars
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_title     VARCHAR2(25)
    ,     cal_desc     VARCHAR2(200)
    ,     CONSTRAINT     calendars_pk     PRIMARY KEY (cal_id)
    );
    
    INSERT INTO     calendars
    VALUES     (1,'Default','This is the default calendar to use for workdays');
    INSERT INTO     calendars
    VALUES     (2,'All Days','This calendar treats all days as workdays');
    INSERT INTO     calendars
    VALUES     (3,'Weekends Off','This calendar gives weekends off, but no holidays');
    INSERT INTO     calendars
    VALUES     (4,'Holidays Off','This calendar gives weekends and holidays off');
    
    CREATE TABLE     workdays
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_date     DATE          NOT NULL
    ,     cal_year     NUMBER(4)
    ,     work_day     NUMBER(3)
    ,     work_date     DATE
    ,     work_week     NUMBER(2)
    ,     work_year     NUMBER(4)
    ,     work_days     NUMBER(5)
    ,     cal_days     NUMBER(6)
    ,     CONSTRAINT     workdays_pk     PRIMARY KEY (cal_id, cal_date)
    ,     CONSTRAINT     cal_id_fk     FOREIGN KEY (cal_id)
                             REFERENCES  calendars (cal_id)
    );
    cal_id - refers to the calendars table
    cal_date - the date of the current calendar
    cal_year - the actual year of calendar for the calendar date
    work_day - work in this year of work (resets every year, starting from 1 is 0 if this calendar date is not a working day)
    work_date - if a day of work, date calendar, otherwise, the date of the schedule for the last day of work (or the first week of the calendar, the next working day)
    work_week - the work date work week (numbered from 1, reset each year the first Sunday of the year, before the first Sunday will be the week last year, and the first year of the calendar will be every day before the Sunday included in the first week, until the first week of a calendar may be more than 7 days)
    work_year - year of the work date
    work_days - day of work shop (except in the first calendar week, before the first shop day is 0), starts at 1 (initially), cumulative (does not reset each year)
    calendar cal_days - day of the work date, starts at 1 (initially), cumulative (does not reset each year)

    Assuming that the calendar starts on 01/01/2010 (these values are less correct - I just do my best guess to provide the sample data):
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,1);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,2);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,3);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/04/2010','mm/dd/yyyy'),2010,1,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,1,4);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/05/2010','mm/dd/yyyy'),2010,2,TO_DATE('01/05/2010','mm/dd/yyyy'),1,2010,2,5);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/23/2010','mm/dd/yyyy'),2010,250,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,357);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/24/2010','mm/dd/yyyy'),2010,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,358);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,366);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),1,2011,250,367);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2011','mm/dd/yyyy'),2011,1,TO_DATE('01/03/2010','mm/dd/yyyy'),1,2011,251,368);
    I tried Googling work calendars, and similar things, but I can't seem to find something that fits my situation. If someone could point me in the right direction, I would appreciate it.

    I work in 10g (XE).

    Published by: user11033437 on July 19, 2011 15:05

    Also, I do not know if it would be better to store just somehow days, each group of resources/doesn't work and generate a schedule on the fly as needed, rather than trying to eventually store thousands of dates in the database?

    Hello

    Interesting problem!

    I don't know exactly what you want, however. Are you are looking for a way to answer such questions "resource A001, what are the first 6 days of work or after January 4, 2010?" or "how many working days does have resource A001 between January 4 and January 12, 2010? Post a few examples of the questions that you might ask, as well as desired outcomes, given the sample data you posted.

    user11033437 wrote:


    I would like to create multiple calendars working and be able to update as needed. Each work schedule would be for 5 years at the most (right now), but it is possible that at some point in the future, I might want to extend that.

    A work schedule can be applied to a single resource or group of resources. Each individual belongs to a group of resources.

    Is a 'group resouce' identical to a 'working group '?
    If a resource moves from one group to another, you need to keep track of historical information? For example, if the resource is A001 not havfe its own calendar and is part of the work_group A Juanuary 1, 2010, but then moves to work_group B July 1, 2010, you will need to answer questions like "how many days have you A001 have in 2010", where it must be remembered that the work_group has apllied calendar during the first half of the year , but work_group Schedule B has been used for the second half?

    What I think, is that if an individual resource has a calendar of work involved, this calendar is used, but if not, it uses the calendar of its resource group, and if the group does not have one, the default schedule is used. Theoretically, each resource can have its own schedule of work, and there would be probably 500 resources to the maximum. In practice, many resources will have the same or similar work schedules.

    Each calendar will be based on one of the 3 standards: all calendars days are working days, on a daily basis, but weekends are working days, or every day except weekends and holidays are working days. (Weeks begin on Sunday and Saturday and Sunday are weekends). The standard calendar would be then modified to create each unique timing as required. For example, if a resource has been used, their calendar is perhaps the standard of works not on weekends and holidays, but could also include a stay of one week in February and stay for a week in July. I'm not sure what the best approach is to define a calendar in the first place and then be able to update an employee decides to holiday (or any other situation that may affect the working days).

    It seems that the easiest thing would be to save only the base calendar exceptions. In other words, because the employee normally respect the calendar ' no weekend or holidays ", simply enter 5 rows for that particular employee Mark 5 days of work, he will be missed in February. If the emplyoee will work Saturday in June (in addition to its regular schedule), then enter a line for each Saturday in June.
    >

    In addition, I really want to be able to integrate the working hours, which can vary daily, but would probably would be pretty standard. I don't know if this information is part of the work table, or as something separate to be combined with work table.

    It depends on what you want exactly. Post a couple opf examples of questions you do not want to answer and the real answers, given the sample data that you post.

    My ultimate goal in doing all this is to try to plan a project of great amongst the many resources.

    Some examples of data showing where I am so far:

    CREATE TABLE     work_groups
    (     group_id     VARCHAR2(5)     NOT NULL
    ,     group_name     VARCHAR2(25)
    ,     group_desc     VARCHAR2(200)
    ,     CONSTRAINT     work_groups_pk     PRIMARY KEY (group_id)
    );
    
    INSERT INTO     work_groups
    VALUES     ('A','Group A','Group A description');
    INSERT INTO     work_groups
    VALUES     ('B','Group B','Group B description');
    INSERT INTO     work_groups
    VALUES     ('C','Group C','Group C description');
    INSERT INTO     work_groups
    VALUES     ('D','Group D','Group D description');
    
    CREATE TABLE     resources
    (     resource_id     VARCHAR2(20)     NOT NULL
    ,     type          VARCHAR2(1)
    ,     description     VARCHAR2(200)
    ,     group_id     VARCHAR2(5)
    ,     CONSTRAINT     resources_pk     PRIMARY KEY (resource_id)
    ,     CONSTRAINT     group_id_fk     FOREIGN KEY (group_id)
                             REFERENCES  work_groups (group_id)
    );
    
    INSERT INTO     resources
    VALUES     ('A001','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A002','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A003','M','text here','A');
    INSERT INTO     resources
    VALUES     ('B001','M','text here','B');
    INSERT INTO     resources
    VALUES     ('B002','M','text here','B');
    INSERT INTO     resources
    VALUES     ('C001','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C002','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C003','M','text here','C');
    INSERT INTO     resources
    VALUES     ('D001','M','text here','D');
    INSERT INTO     resources
    VALUES     ('12345','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12346','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12347','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12348','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12349','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12350','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12351','L','text here','D');
    

    It seems that all lines have the same description. If the description of the issues in this problem, would not better illustrate how this is important, having different descrioptions which appeared in different outputs? However, if the description plays no role in this problem, then why include in the sample data at all?

    I don't know if I should have a separate table to define a relationship between a resource or resource groups and a calendar id (each resource or group would be able to assign 1 calendar unique id, although several resources/groups could share the same schedule id), or if I have to add an additional column to each table above to assign the calendar id.

    CREATE TABLE     calendars
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_title     VARCHAR2(25)
    ,     cal_desc     VARCHAR2(200)
    ,     CONSTRAINT     calendars_pk     PRIMARY KEY (cal_id)
    );
    
    INSERT INTO     calendars
    VALUES     (1,'Default','This is the default calendar to use for workdays');
    INSERT INTO     calendars
    VALUES     (2,'All Days','This calendar treats all days as workdays');
    INSERT INTO     calendars
    VALUES     (3,'Weekends Off','This calendar gives weekends off, but no holidays');
    INSERT INTO     calendars
    VALUES     (4,'Holidays Off','This calendar gives weekends and holidays off');
    

    What is cal_id = 1? How is it different from the other three?

    
    CREATE TABLE     workdays
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_date     DATE          NOT NULL
    ,     cal_year     NUMBER(4)
    ,     work_day     NUMBER(3)
    ,     work_date     DATE
    ,     work_week     NUMBER(2)
    ,     work_year     NUMBER(4)
    ,     work_days     NUMBER(5)
    ,     cal_days     NUMBER(6)
    ,     CONSTRAINT     workdays_pk     PRIMARY KEY (cal_id, cal_date)
    ,     CONSTRAINT     cal_id_fk     FOREIGN KEY (cal_id)
                             REFERENCES  calendars (cal_id)
    );
    

    I suspect that there is a simpler way, especially if there is a regular order to types of day (e.g., people who take vacations outside normally get weekeneds, too).
    You may have a table like this, that was a line a day:

    CREATE TABLE  days
    (       a_date      DATE     PRIMARY KEY
    ,     day_type    NUMBER (1)              -- 1=Weekend, 2=Holiday, 3=Other
    );
    
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-01', 2) /* New Years Day */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-02', 1) /* Saturday */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-03', 1) /* Sunday */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-04', 3) /* Monday - back to work */;
    ...
    

    Another table (I'll call him work_sched) shows what resources are not working when:

    CREATE TABLE  work_sched
    (       p_key          NUMEBR     PRIMARY KEY     -- Arbitrary Unique ID
    ,     group_id         VARCHAR2 (5)          -- Exactly one of the columns group_id or ...
    ,     resource_id      VARCHAR2 (20)          --     ... resource_id will always be NULL
    ,     a_date              DATE
    ,     works_on     NUMBER (1)          -- works when days.day_type >= this value
    ,     remarks          VARCHAR2 (40)
    );
    

    To indicate that work_group 'L' is working normally on type 3 days only (i.e., weekends and public holidays):

    INSERT INTO work_sched (group_id, a_date, works_on) VALUES ('L', NULL, 3);
    

    (Assume that p_key is filled by a trigger).
    The NULL value in the column a_date indicates that it applies to every day, unless another line in the work_sched table. Instead of NULL, mabe some date impossible (for example, January 1, 1900) would be more convenient to specify default values.
    Exceptions to this schedule would be indicated by other lines in work_sched. For example, if "12345" is an employee who is on vacation for a week in February:

    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-08', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-09', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-10', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-11', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-12', 4, 'Vacation');
    

    And if that employee works Saturday in June:

    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-05', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-12', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-19', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-26', 1, 'Fiscal year-end crunch');
    

    Where to find the number of days of work, we would join work_sched in days using these two conditions:

    ON   work_sched.date           = days.a_date
    AND  work_sched.works_on  <= days.day_type
    

    cal_id - refers to the calendars table
    cal_date - the date of the current calendar
    cal_year - the actual year of calendar for the calendar date
    work_day - work in this year of work (resets every year, starting from 1 is 0 if this calendar date is not a working day)
    work_date - if a day of work, date calendar, otherwise, the date of the schedule for the last day of work (or the first week of the calendar, the next working day)
    work_week - the work date work week (numbered from 1, reset each year the first Sunday of the year, before the first Sunday will be the week last year, and the first year of the calendar will be every day before the Sunday included in the first week, until the first week of a calendar may be more than 7 days)
    work_year - year of the work date
    work_days - day of work shop (except in the first calendar week, before the first shop day is 0), starts at 1 (initially), cumulative (does not reset each year)
    calendar cal_days - day of the work date, starts at 1 (initially), cumulative (does not reset each year)

    There is a large amount of denormalized data. in other words, you should be able to easily deduct cal_date cal_year, but sometimes it is convenient store denormalized data.

    Assuming that the calendar starts on 01/01/2010 (these values are less correct - I just do my best guess to provide the sample data):

    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,1);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,2);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,3);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/04/2010','mm/dd/yyyy'),2010,1,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,1,4);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/05/2010','mm/dd/yyyy'),2010,2,TO_DATE('01/05/2010','mm/dd/yyyy'),1,2010,2,5);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/23/2010','mm/dd/yyyy'),2010,250,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,357);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/24/2010','mm/dd/yyyy'),2010,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,358);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,366);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),1,2011,250,367);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2011','mm/dd/yyyy'),2011,1,TO_DATE('01/03/2010','mm/dd/yyyy'),1,2011,251,368);
    

    I tried Googling work calendars, and similar things, but I can't seem to find something that fits my situation. If someone could point me in the right direction, I would appreciate it.

    I work in 10g (XE).

    Published by: user11033437 on July 19, 2011 15:05

    Also, I do not know if it would be better to store just somehow days, each group of resources/doesn't work and generate a schedule on the fly as needed, rather than trying to eventually store thousands of dates in the database?

    That's what I thought, too.

    Post some sample data (if it is not what you have already posted), some examples of questions and the right answers you want from each question given that the sample data.

  • The time in the calendar works with an hour between start and end time

    Until recently, calendar worked OK but now only allow me to have a time of an event if I try to put the first gestures of time within an hour of arrival times longer.

    There is a symbol link to the right of the time of departure and arrival. If the points are in contact with the time interval that you have in the calendar (by default 60 minutes) options will be kept when you change the time. Click on this symbol, and the points will be away and stop this action.

  • calculate the number of days excluding non-working days

    11.2.0.4

    theres a fairly common request over the years to get the diff between 2 dates, excluding weekends, theres many ways to to do, however, I would like to go a step further and exclude everything not professional

    day.

    We have a company function that calculates whether a date is a holiday for our Organization.  We can pass a date and we have a Y or N back.     In the example below, the l' appel call function shows there for Saturday to show how we can identify the non-working day.

    Can anyone think of a way that we could use to get a sum of N s between 2 date fields in a line using this function?   IM thinking if we get the right formula/function to create a virtual column with calculating pre built as it can start to get expensive if she had to loop through every possible day between 2 dates to see it is a business day, all by a count.

    create the table t1_count

    (identification number,

    date of TS1,

    date of TS2)

    insert into t1_Count

    values (1, sysdate, sysdate - 7);

    insert into t1_Count

    values (2, sysdate, sysdate - 4);    -Saturday

    commit;

    SELECT id, ts1 ts2, .isholiday (ts1), isholiday (ts2) of t1_count;

    106/03/2015-14:30:5127/05/2015 14:30:51NN
    106/03/2015-14:32:2930/05/2015 14:32:29NTHERE

    That fold to my brain...

    ABS (trunc (sysdate - 40) + level - 1 - trunc (sysdate)) that's equivalent to the abs (level - 41)...

    Why not just level<=>

  • Procedure for the number of working days per month when the user enters to and from everyday

    Hi all

    Can provide you a solution to this - procedure for the number of working days per month when the user enters and days.

    Suppose that the user enters November 18, 2014 start date and date as November 23, 2014.

    The output should display

    Count: 4

    November 18, 2014 Mar

    Sea 19 November 2014

    November 20, 2014 game

    Fri November 21, 2014

    It will exclude Saturday and Sunday.

    Hello

    Here is an example of removing dates Saturday and Sunday:

    with days as(
         select (trunc(sysdate, 'YEAR') + level) as col from dual
         connect by level < 365
    )
    select * from days
    where trim(to_char(col, 'DAY', 'NLS_DATE_LANGUAGE=ENGLISH')) not in ('SATURDAY', 'SUNDAY')
          and col between to_date('18.11.2014', 'DD.MM.YYYY') and to_date('30.11.2014', 'DD.MM.YYYY')
    order by col;
    

    Cheerz,

    Stako

  • Are working day following or collect and return expenses, the same?

    Hello

    When I bought an XPS 13 (2015), the announcement said NBD, I just checked my status of the warranty on the dell site and he says collect and return.

    Are they the same?

    I'm looking, to extend the warranty but not sure that such extensions exist.

    Thank you

    NBD is on-site, next business day.  To collect and return costs is repair - they send a box, you ship the system and he returned to 7-10 working days later.

  • Display internal to 10 working days to the iRecruitment

    Gurus,

    I'm new to iRecruitment and would require assistance to get a feature.

    Client has a requirement in which they say that its employees in their organization can also apply to internal jobs for 10 working days before it is posted to the outside world.

    Can someone help me to achieve this?

    Kind regards

    Saurabh

    Have you checked the profile option - IRC: days of internal validation


    The implementation Guide - http://docs.oracle.com/cd/E18727_01/doc.121/e13518/T24319T440324.htm

    Set the days of display to set the number of days internal jobs

    If you want to make available the details of the work of your employees first, and then set the IRC: days of internal validation profile option. You specify the number of days during which the messages one app announced internally before posting the announcement on the external site.

    See you soon,.

    Vignesh

  • 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;
    /  
    
  • Convert a representative number 'working day' in hours

    I have a query that pulls in a column < Completion_Days > this working days as a value list that appears in the range between 0 and up to perhaps 10 or higher.
    What I need to do, is that digital to convert to a format of HH:MN:SS time.

    There are an other columns < Completion_Hours > and < Completion_Minutes > I also want to convert it to a time so format. Here is a sample of my data:

    SEQUENCE DAYS COMPLETION_HOURS COMPLETION_MINUTES
    1 0 0 15
    2 0 0 15
    3 1 0 0
    4 0 0 15
    5 0 0 15
    6 1 0 0
    7 0 0 15
    8 0 0 15
    9 0 4 0
    10 0 0 15
    11 0 4 0
    12 0 4 0
    with sample_table as (
                          select  2 Completion_Days,
                                  4 Completion_Hours,
                                  15 Completion_Minutes
                            from  dual union all
                          select  0 Completion_Days,
                                  4 Completion_Hours,
                                  5 Completion_Minutes
                            from  dual
                         )
    select  case
              when Completion_Days * 8 + Completion_Hours < 10 then '0'
            end || (Completion_Days * 8 + Completion_Hours) || ':' || to_char(Completion_Minutes,'FM00') || ':00' res
      from  sample_table
    /
    
    RES
    ------------
    20:15:00
    04:05:00
    
    SQL> 
    

    SY.

  • I'm looking for the 1st working day of the week.

    Hello

    I'm looking for the 1st working day of the week except Saturday, Sunday and holidays. I have vacation, the name of the table that contains the columns HolidayDate and HolidayDescription.

    Ex:

    01/10/2011 is monday (i.e) 1st company day.check if it is in the host table, then return the result as 01/11/2011 other returns the output as a 11-1-2011(which is the first business day of this week).


    Can someone tell me the query to solve?

    Hello

    If dt is any DATE, it is the first day of work in the same week as dt:

    WITH     all_week     AS
    (
         SELECT     TRUNC (dt, 'IW') + LEVEL - 1     AS a_dt
         FROM     dual
         CONNECT BY     LEVEL <= 5
    )
    SELECT     MIN (a_dt)     AS first_work_dt
    FROM     all_week
    WHERE     a_dt     NOT IN (
                      SELECT  holiday_dt
                      FROM    holiday
                     )
    ;
    

    This assumes that you have never 5 consecutive days. (Where I work, holidays are always at least a week apart, so that's fine.)
    If you have a week's holiday, increase the number of 'magical' in the CONNECT BY clause.

    It also means that holiday.holiday_dt = TRUNC (holiday.holiday.dt).

  • Check the number of consecutive working days of Absence from a list of dates (F

    Hi all

    We have Oracle 11.5.7 Application human resources and I have a request to create an Absence report (using sql * more coding, which can be downloaded on the discoverer to run the report by the user) as follows:

    Columns of the sample:
    ABSENCE_CATEGORY
    ABSENCE_TYPE
    ABSENCE_START_DATE
    ABSENCE_END_DATE
    ABSENCE_DAYS

    Sample data:
    EMPLOYEE A (FOR LACK OF PERIOD 2009)
    ABSENCE_CATEGORY ABSENCE_TYPE ABSENCE_START_DATE ABSENCE_END_DATE ABSENCE_DAYS
    Annual leave, April 27, 2009 April 30, 2009 4
    May 4, 2009 educational leave may 4, 2009 1
    Leave annual P 5 May 2009 may 12, 2009 6
    ...

    TOTAL: 11 DAYS OF CONTINUOUS WORK ON LEAVE
    NOTES:
    MAY 1, 2009 HOLIDAY
    May 2, 2009 weekend & may 3, 2009
    Weekend May 9, 2009 & may 10, 2009

    B EMPLOYEE (FOR ABSENCE PERIOD 2009)
    ABSENCE_CATEGORY ABSENCE_TYPE ABSENCE_START_DATE ABSENCE_END_DATE ABSENCE_DAYS
    Annual leave, may 18, 2009 may 29, 2009-10
    ...
    TOTAL: 10 DAYS OF CONTINUOUS WORK ON LEAVE


    C EMPLOYEE (FOR ABSENCE PERIOD 2009)
    ABSENCE_CATEGORY ABSENCE_TYPE ABSENCE_START_DATE ABSENCE_END_DATE ABSENCE_DAYS
    8 June 2009 annual leave June 17, 2009 8
    ...
    TOTAL: 8 DAYS OF CONTINUOUS WORK ON LEAVE

    IF AN EMPLOYEE HAS TAKEN MORE CONSECUTIVE OR 10 WORKING DAYS SHOULD BE EXCLUDED FROM THE STATE.
    THAT IS WHY IN THE EXAMPLE ABOVE ONLY USED C MUST BE RETURNED BY THE QUERY.

    Ideas/comments if and how to achieve the highest performance will be much appreciated.
    Thanking you in advance,
    Best regards
    Elena

    Hello

    Cannot start a command with the keyword WITH in SQL * Plus 8 (or earlier).

    The best thing to do is to install a later version of SQL * Plus or SQL Developer. (You can have several versions, if you need. SQL * Plus 10 and more will not work with an Oracle database 8)

    Otherwise, you can re-write the query so that the command does not begin with the keyword WITH.
    For example:

    SELECT  *
    FROM    (  WITH A AS ...
            );
    
  • I'm using MS works calendar every day as a reminder tool. I have another software that has this feature for Windows 8?

    I have Microsoft works 9.0 is installed on my windows 7. I'm going to buy a new computer with windows 8. Y at - it software that has this feature? I understand that works is an abandoned product.

    [Moved from comments]

    I did some checking into it.  I use Live Mail program, but not much for the calendar (he has some personal things, but by-and-large I use Outlook calendar to my business for most of my appointments and reminders).

    So the Live Mail application has a setting for reminders, but it uses the setting of Outlook.com reminder to send a reminder email before the start of the event (which I think is terrible because I'm not getting emails real time anyway).  My point also appear on my phone, but also a small flag of the Windows 8 calendar applet on but only happened because they all sync to my same Hotmail account.

    Therefore, it seems that you have a few options. If the reminders of the integrated application suffice (this purple headband), you can simply link to the same account as your application Live Mail calendar and be the source of reminder notifications.

    Click here to enlarge this image

  • Citing the calendar in day of the week (Mon, Mar, sea etc)...

    Hello

    How to invoke the native calendar to a specific day of the week, as Monday.

    If today is Monday call for Monday, if today of call Tuesday to next Monday, etc.

    You're right, official docs seems to be inaccurate, it must be:
    Action: "bb.calendar.OPEN."
    MIME: "text/calendar".
    Data : '? "view annex = & date = MON Jul 20% 2027% 202015.

    'view' application works and will actually view day but date of query does not work, although I respected the date format required in this doc:
    https://developer.BlackBerry.com/native/documentation/device_platform/invocation/calendar.html

    I tried with a few different date format but cannot make it work.

Maybe you are looking for