Calculate date/day between 2 days/dates

Dear Sir

APEX full version 4.1
Full DB/version/edition/host operating system by default oracle db
Apex.Oracle.com Web server architecture (EPG, SST or APEX listener/host operating system)
Browser (s) and version (s) used firefox 12
24 theme
Model (s) default
Region/section type (s) see below for details


I have a question about how to select or get a date, which must be between 2 dates.
I'm not sure how to solve this problem. I know I should use plsql or sql with following statements...
 between to_date(:P9_BUILDEND, 'MM/DD/YYYY')
 AND to_date(:P9_BREAKDOWNSTART, 'MM/DD/YYYY'); 
Situation

I point X (date field) MM/DD/YYYY
I Y (date field) MM/DD/YYYY point
I point Z (date field) MM/DD/YYYY

the point X contains for example 05/03/2012
element Z contains for example 07/03/2012

I want Y point for the date between points X and Z. Is this possible to validation, calculation or dynamic action?


Mere student :)

If you haven't tried my suggestion, then try with your date format

Choose return Boolean function and add the code below in 1 Expression of Validation

Please replace X, Y and Z with your actual page elements

if to_date(Y,'MM/DD/YYYY') between to_date(X,'MM/DD/YYYY') and to_date(X,'MM/DD/YYYY') then
//validation is passed
   return true;
else
//validation error is raised
   return false;
end if;

Tags: Database

Similar Questions

  • Calculate business hours between 2 dates with negative numbers

    Hi all

    I use a function to calculate the difference between 2 dates schedules. The function was taken and adapted from this thread:

    Calculate business hours between two dates in a cursor

    CREATE OR REPLACE
      FUNCTION get_bus_minutes_between(
                                       p_start_date DATE,
                                       p_end_date DATE
                                      )
        RETURN NUMBER
        IS
            v_return NUMBER;
        BEGIN
            with t as (
                       select  case level
                                 when 1 then greatest(p_start_date,trunc(p_start_date) + 9 / 24)
                                 else trunc(p_start_date) + level - 15 / 24
                               end start_dt,
                               case connect_by_isleaf
                                 when 1 then least(p_end_date,trunc(p_end_date) + 20 / 24)
                                 else trunc(p_start_date) + level - 4 / 24
                               end end_dt
                         from  dual
                         connect by level <= trunc(p_end_date) - trunc(p_start_date) + 1
                      )
            select  sum(greatest(end_dt - start_dt,0)) * 24 * 60 work_minutes
              into  v_return
              from  t
              where trunc(start_dt) - trunc(start_dt,'iw') < 5; -- exclude weekends
            RETURN v_return;
        END;
        /

    I am running into an issue that when the p_end_date is before the p_start_date value the function returns the full time between the dates without regard for business hours. if the end_date is before the start date I get the expected result i.e. difference between the dates in business hours.

    Using example dates of start 19th October 2012 13:00:00 and end 22nd october 2012 13:21:00 the business minutes are 681. However if i reverse the dates I get -4341.


    Correct labour code is the following, I've annotated so that he could help someone else looking for a solution like this:

    CREATE OR REPLACE
      FUNCTION get_bus_minutes_between(
                                       p_start_date DATE,  --these are the 2 dates passed into the function
                                       p_end_date DATE     --these are the 2 dates passed into the function
    )
    RETURN NUMBER
    IS
    v_return NUMBER;

            l_start  DATE;

            l_end    DATE;

            l_factor NUMBER;
        BEGIN

            IF p_start_date <= p_end_date THEN            --this IF section checks which of the 2 dates is the greatest

               l_start  := p_start_date;                  -- and then assigns the earliest date to p_start_date

               l_end    := p_end_date;

               l_factor := 1;

            ELSE   -- swap the dates around, and multiply the result by -1

               l_start  := p_end_date;

               l_end    := p_start_date;

               l_factor := -1;

            END IF;

            with t as (
                       select  case level
                                 when 1 then greatest(l_start,trunc(l_start) + 9 / 24)  -- this sets the start of working hours
                                 else trunc(l_start) + level - 15 / 24  --if the start time is adjusted this value must also be adjusted
                               end start_dt,
                               case connect_by_isleaf
                                 when 1 then least(l_end,trunc(l_end) + 20 / 24)  -- this sets the end of working hours
                                 else trunc(l_start) + level - 4 / 24  -- if the end time is adjusted this value must also be adjusted
                               end end_dt
                         from  dual
                         connect by level <= trunc(l_end) - trunc(l_start) + 1
                      )
            select  sum(end_dt - start_dt) * 24 * 60 work_minutes  -- this subtracts the 2 dates and then multiplies by hours and minutes
              into  v_return
              from  t
              where trunc(start_dt) - trunc(start_dt,'iw') < 5; -- this exclude weekends
            RETURN v_return * l_factor;  -- this gives the negative or positive results so you can see if it was completed before or after the required date.
        END;
        /

  • How to calculate the difference between a Date column and the Date yesterday in the analysis (in the formula in the column)

    . For example, I need to calculate the difference between a date column, 'Table_Name '. "' Column_Name ' and (Current_Date-1). I tried different ways to do this. But nothing seems to work.

    Try the below formula.

    Replace "Time". "" Date "with your column.

    TIMESTAMPDIFF (SQL_TSI_DAY, "Time". "Date", TIMESTAMPADD (SQL_TSI_DAY-1, CURRENT_DATE))

    Thank you!

  • Calculate business hours between two dates in a cursor

    Hello, its me again (?).

    Yesterday, I got a solution to a problem here where I need to calculate the hours between two dates, excluding Sat/Sun and from 09:00 to 18:00. I'm now putting this login in a PL/SQL block, so I can calculate it for each record in a slider, all by looping.
    with t (start_date
           ,end_date
           )
    as (select  to_date('22-oct-2012 09:00:00','dd-mon-yyyy hh24:mi:ss') start_dt,
                           to_date('23-oct-2012 09:00:00','dd-mon-yyyy hh24:mi:ss') end_dt
        from dual
       )
    , hrs (dt) as
      (select start_date
       from   t
       union all
       select dt +1/24/60
       from   hrs
       where  hrs.dt < (select end_date-1/24/60 from t)
      )
    select count(*)/60
    from hrs
    where to_char(dt,'dy') not in ('sat','sun')
    and  to_number(to_char(dt,'hh24')) not between 18 and 23
    and  to_number(to_char(dt,'hh24')) not between 0 and 8
    /
    The logic above, I'm up here:
    FOR c_record IN c_1 LOOP
    //For each record, check if the two dates meet the criteria and then raise the counters accordingly
    select  to_date(c_record.REPORTADA,'dd-mon-yyyy hh24:mi:ss') INTO vFch1 FROM DUAL;
    SELECT  to_date(c_record.INICIOREAL,'dd-mon-yyyy hh24:mi:ss') INTO vFch2 FROM DUAL;
    
    IF ((vHoras > 2) AND c_record.PRIORIDAD=3) THEN
      vContOk :=vContOk + 0;
      vContBad := vContBad+1;
      vContOt   := vContOt+1;
    ELSE 
      vContOk :=vContOk +1;
      vContBad := vContBad+0;
      vContOt   := vContOt+1;
    END
        IF;
    
    IF ((vHoras > 4) AND c_record.PRIORIDAD=2) THEN
      vContOk :=vContOk + 0;
      vContBad := vContBad+1;
      vContOt   := vContOt+1;
    ELSE
      vContOk :=vContOk +1;
      vContBad := vContBad+0;
      vContOt   := vContOt+1;
    END IF;
    
    IF ((vHoras > 16) AND c_record.PRIORIDAD=1) THEN
      vContOk :=vContOk + 0;
      vContBad := vContBad+1;
      vContOt   := vContOt+1;
    ELSE
      vContOk :=vContOk +1;
      vContBad := vContBad+0;
      vContOt   := vContOt+1;
    END IF;
    
    END LOOP;
    I really don't like if the performance is horrible because it will run once a month and should spend only 40-100 records.
    However, I can't find a way to use this connection even in this case

    Could you help me?
    Thank you!

    Greetings,
    NACEUR

    N wrote:
    I need to calculate the number of minutes between two dates, only count the hours from 9 to 18hs.

    CREATE OR REPLACE
      FUNCTION get_bus_minutes_between(
                                       p_start_date DATE,
                                       p_end_date DATE
                                      )
        RETURN NUMBER
        IS
            v_return NUMBER;
        BEGIN
            with t as (
                       select  case level
                                 when 1 then greatest(p_start_date,trunc(p_start_date) + 9 / 24)
                                 else trunc(p_start_date) + level - 15 / 24
                               end start_dt,
                               case connect_by_isleaf
                                 when 1 then least(p_end_date,trunc(p_end_date) + 18 / 24)
                                 else trunc(p_start_date) + level - 8 / 24
                               end end_dt
                         from  dual
                         connect by level <= trunc(p_end_date) - trunc(p_start_date) + 1
                      )
            select  sum(greatest(end_dt - start_dt,0)) * 24 * 60 work_minutes
              into  v_return
              from  t
              where trunc(start_dt) - trunc(start_dt,'iw') < 5; -- exclude weekends
            RETURN v_return;
    END;
    /
    

    For example:

    SQL> select get_bus_minutes_between(
      2                                 to_date('20-oct-2012 13:00:00','dd-mon-yyyy hh24:mi:ss'),
      3                                 to_date('22-oct-2012 13:21:00','dd-mon-yyyy hh24:mi:ss')
      4                                ) work_minutes
      5    from dual
      6  /
    
    WORK_MINUTES
    ------------
             261
    
    SQL> 
    

    SY.

  • Calculate the days of salary

    Dear friend


    I want to calculate the days of salary. We pay the salaries of the 21st of the month last to the 20th of the current month.

    I want to create a view where it will show of the the Scriptures based on this month wise condition

    Select empno, name, daytype, count (empno) days, MAX (TO_CHAR (ADATE, 'MONTH')) in dailyattendence
    When al > =('20-OCT-2010') AND ADATE < =('20-NOV-2010')
    Group by empno, daytype
    order by empno


    for ex

    562 SEUN BÉLANGER AFTERNOON OCTOBER 1
    562 SEUN BÉLANGER MORNING OCTOBER 2
    562 SEUN BÉLANGER NIGHT OCTOBER 2
    562 SEUN OFF BÉLANGER 1 OCTOBER

    562 SEUN BÉLANGER AFTERNOON NOVEMBER 1
    562 SEUN BÉLANGER MORNING 2 NOVEMBER
    562 SEUN BÉLANGER NIGHT NOVEMBER 2
    562 SEUN OFF BÉLANGER 1 NOVEMBER

    Suggest me how to set the dates so that I can get the report as shown above,

    Sandy

    It doesn't really have anything to do with the forms, but here's a solution.
    To get the 21st of the month before you use:

    select to_date('21'||to_char(add_months(sysdate,-1),'mmyyyy'),'ddmmyyyy')
    from dual;
    
    TO_DATE('
    ---------
    21-OCT-10
    

    The same for the 20th of this month. So you get:

    where adate between to_date('21'||to_char(add_months(sysdate,-1),'mmyyyy'),'ddmmyyyy')
       and to_date('20'||to_char(sysdate,'mmyyyy'),'ddmmyyyy')
    

    An addition: If your date includes a time, you must use the use trunc (date).

    Published by: InoL on November 11, 2010 12:10

  • Flash Template that follow and calculate data?

    I am interested in creation of this emerging and calculate data and give detailed results based on the answers.  Is it possible to create, follow and make this comment in Flash?  Something like the personality test followed.

    I don't know what you mean... Flash is an aspect of Quiz, but you can also create quizzes using Flash.  You will need to learn a bit of everything that involves Flash.  Your main goal to achieve this feature will learn Actionscript and how to interact with a resource of data such as a database of Flash.  He must also learn to use a scripting language on the server, such as PHP, to handle exchanges between the Flash and the database side.

    If you are a beginner with Flash, you have much to learn before you can expect something like what you say you want to create.  If you are a beginner in programming, even more.

  • Calculate the difference between the subtotals

    I'm working on a simple report that looks like this:

    EmployeeID EmployeeName Date salary wages
    1234 Tom June 1, 2009 $2000.00
    2345 harry $2400,00 June 1, 2009
    3456 sally $3000.00 June 4, 2009
    Partial total salary: $7400,00

    Advances of salary Date EmployeeID EmployeeName
    2345 harry $1000.00 may 15, 2009
    3456 sally $750.00 may 15, 2009
    Advances subtotal: $1750,00
    Total: $5650,00

    Is there any function in Discoverer, which calculates the difference between subtotals and the poster as a total. Please advise if you can create a named for this sum calculation?

    Published by: user1049091 on August 6, 2009 11:33

    Published by: user1049091 on August 6, 2009 12:38

    Hello

    Not really possible. You the best approach is probably to create a named calculation that contains the difference: for example

    Decode (salary_type, 'Pay', 'Progress', - wages)

    Then create a total on this calculation. You can often hide the calculation itself in terms of formatting and white text on white background.

    Rod West

  • Need help to calculate the difference between times

    Hi all

    I have two fields that stores just the hour in 24-hour ex: 08:00 and 20:00 now I want to calculate the difference between two times

    Kindle help me

    Thanks for your help

    Thank you
    Ravi

    Hello

    diiference in hours

    SQL> WITH T AS (SELECT '08:00' ST_TIME, '20:00' END_TIME FROM DUAL)
      2  SELECT (TO_DATE (END_TIME, 'HH24:MI') - TO_DATE (ST_TIME, 'HH24:MI')) * 24 DIFF_HOURS
      3    FROM T;
    
    DIFF_HOURS
    ----------
            12
    
    SQL> 
    

    G.

  • FormCalc - how to calculate the difference between the two fields datetime in hh: mm?

    Hello!

    I am building a form of time sheet in which I need to calculate the difference between the start and end times and present the result.

    I'm trying to do with FormCalc but if it is easier with JS is ok too.

    So that's what I did on the total field, by using the calculate on a NUMERIC field called decimalValue event:

    elapsed = Time2Num (endTime.formattedValue, "HH: mm")-Time2Num (startTime.formattedValue, "HH: mm")

    And then I tried to convert a time field:

    Total = decimalValue.rawValue;

    $.formattedValue = Num2Time (total, "HH: mm")

    Well, it doesn't work, it gives me crazy results in the datetime (total) field. If I type 09:00 and 09:30, the final result is... 22:30. Huh?

    Please, could someone help me understand how this thing works?

    Thanks a lot for the tips!

    Marcos

    Hi Marcos,

    Here are some examples:

    https://Acrobat.com/#d=kCPIgVkd09qrx6h-WRXxbQ

    https://Acrobat.com/#d=EsWqBMBt3sgEXnMSsK5pRA

    Hope that helps,

    Niall

  • calculate the days remaining until a given date

    Hello

    I am facing a problem and can not find a good solution.

    I want to calculate how many days there are still up to a certain date.

    It is because I want to build in a callback to the re-kalibrate hardware which is used every year.

    So if it's today 05/11/2012, and the constant is 21/05/2012 labview must calculate there are still 10 days left before the re-kalibration must be finished.

    Someone has any idea how to do this?

    Thanks in advantage!

    of course, don't forget that time stamps are DBL in seconds.

    Hope this helps

  • calculate data for the last 30 days according to the date of sys

    SELECT DT, ITEMCODE, ITEMNAME, QTY
    FROM   TABLE1
    In above given the query, how do I calculate the details of the amount of the last 30 days, APR, MAY, and JUNE

    As the month during JULY, August, the amount of detail is required for the last 30 days (from sysdate), MAY, JUNE, July

    Please suggest.

    Yogesh

    Published by: user12957777 on July 28, 2010 03:16

    Hello

    CASE expressions can filter data in specific columns:

    SELECT     SUM ( CASE
                WHEN dt >= ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH')
                             , -3
                             )
                AND  dt <  ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH')
                             , -2
                             )
                THEN qty
               END
             )          AS third_month
    ,     SUM ( CASE
                WHEN dt >= ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH')
                             , -2
                             )
                AND  dt <  ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH')
                             , -1
                             )
                THEN qty
               END
             )          AS second_month
    ,     SUM ( CASE
                WHEN dt >= ADD_MONTHS ( TRUNC (SYSDATE, 'MONTH')
                             , -1
                             )
                AND  dt <               TRUNC (SYSDATE, 'MONTH')
                THEN qty
               END
             )          AS last_month
    ,     SUM ( CASE
                WHEN dt >= TRUNC (SYSDATE) - 30
                AND  dt <  TRUNC (SYSDATE)
                THEN qty
               END
             )          AS last_30_days
    FROM     table1
    ;
    

    You can do this with GROUP BY, in addition, if you want to separate for each itemname (for example) lines.

    I guess some things, like what do you mean by the last 30 days.

    If you wish to post a few 9creation TABLE or INSERT sample data) and the results you want from this data, then I could test this.

  • calculate the day of the year using the date.

    Hi all
    Can calculate us the day of the year using the date form? Is this possible? Please help me thanks in advance
    Like this
    30/08/2009-30/08/2010 after calculation - 365


    Sarah

    Published by: SarahSarahSarah on August 30, 2009 12:49 AM

    Sarah.

    : ins1.noday must be a part of number!

    Create a function in forms like this:

    function get_nodays ( f_dtm_start in date,
                          f_dtm_end   in date ) return number is
    begin
    if
      f_dtm_start is null OR
      f_dtm_end is null
    then
      return ( null );
    end if;
    return ( trunc ( f_dtm_start ) - trunc ( f_dtm_end ) );
    exception when others
    then message ( sqlerrm || ' in function get_nodays occured.' );
    return ( null );
    end;
    

    Call this function in the when-validate-point triggers on ins1. INSPERIOD and: ins1.end love

    :ins1.noday := get_nodays ( :ins1.INSPERIOD, :ins1.end );
    

    It is redundant to have the: noday as a cause of part of database
    the value may by calculated every time using the values INSPERIOD and: end.

  • How to calculate the days with 2 Date/time fields

    Hello
    I tried to create a workflow to update a numeric field with the following formula, however, I get an error message "value too long for the field 'ZNum_0' (maximum size 16) (SBL-DAT-00235). Can I know what is the problem with my calculation?

    dtCloseDate - dtAssignDate

    Thank you

    Hi, your formula is correct.

    You could be facing this problem because it will assess the value in decimal and result has no set limit for the decimal point. As digital field accept only 16 characters, the problem is occure.

    You must truncate the result with a defined decimal.

    Hope this will help you
    Dinesh

  • How to calculate the difference between 2 dates, but with interruptions and stops between

    Hello

    How can I calculate the difference in minutes between 2 dates but taking into account the existence of a table in the Appendix, so if between start_date and end_date arguments, there is no 'work time' then this part of the time will not be included in the total difference.

    Records of the time table example:

    Time_configuration start_hour end_day end_hour
    219:00307:00
    319:00407:00

    so for example first record said that on Monday you start at 19:00 and leave the next day at 7:00 and then save the same sort of thing.

    There is an event that I want to track how many minutes lasted. for example, this event began the day 2 at 19:00 and ended the day 3 at 21:00

    Theoretically, this event really lasted: 840 minutes. This 840 minutes are within the limits of the annex.

    Thanks in advance.

    The storage of the dates not as data type DATE in most cases is bad design. In addition, how do you know what day of the date is 2 at 19:00? East - Monday 2 November 2015 or Monday, March 7, 2016? It is the same for the event. In any case, assuming that both calendar and events don't extend over several weeks:

    According to schedule)
    Select time_configuration 2, 19:00 ' start_hour, end_day 3,' 07:00 ' end_hour of all the double union
    Select 3, 19:00 ', 4,' 07:00 ' double
    ),
    event like)
    Select event_id 1, time_configuration 2, 19:00 ' start_hour, end_day 3: 21:00 ' end_hour of the double
    )
    Select e.event_id,
    Sum)
    less (e.end_day + to_date (e.end_hour, 'HH24'), s.end_day + to_date (s.end_hour, 'hh24:mi')).
    greater (e.start_day + to_date (e.start_hour, 'HH24'), s.start_day + to_date (s.start_hour,'hh24:mi'))))
    ) * 24 * 60 minutes
    Appendix s,
    e event
    where e.start_day + to_date(e.start_hour,'hh24:mi')< s.end_day="" +="">
    and e.end_day + to_date(e.end_hour,'hh24:mi') > s.start_day + to_date(s.start_hour,'hh24:mi')
    E.event_id group
    /

    EVENT_ID MINUTES
    ---------- ----------
    1 840

    SQL >

    SY.

  • Calculate the hours between 2 business days

    Hi all

    Do a complex calculation on the days I do not know how to achieve this.

    Here is my case:

    I have a week of work with hours of work.

    Then there's this delivery time sheet for how long should be set an order ready to be delivered:

    Order1: max 5 hours of work

    Order2: max 8 working hours

    Order3: max 16 hours of work

    When an order is placed, the time of the order is recorded, and when an order has been set in ready to be delivered, this time is also registered.

    How to calculate the time difference between the time where an order has been placed and the time where the order has been on loan. Thereby also taking into account the working days and hours of work.

    Example: type order1 order was placed Tuesday at 15:00.

    Order has been fixed loan Wednesday at 14:00

    This means that to fix this ready order lasts 7 hours, which means that it is 2 hours time.

    CREATE TABLE REF_WORKDAYS
      (
        
        "WERKDAG"       VARCHAR2(15 ) NOT NULL ENABLE,
        "SOORT_WERKDAG" VARCHAR2(15 ) NOT NULL ENABLE,
        "BEGIN_TIJD"    VARCHAR2(10 ) NOT NULL ENABLE,
        "EIND_TIJD"     VARCHAR2(10 B) NOT NULL ENABLE,
        
      )
    

    Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Monday','WORKINGDAY','08:00','16:00');
    Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Tuesday','WORKINGDAY','08:00','16:00');
    Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Wednesday','WORKINGDAY','08:00','16:00');
    Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Thursday','WORKINGDAY','08:00','16:00');
    Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Friday','WORKINGDAY','08:00','16:00');
    Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Satrurday','WORKINGDAY','08:00','14:00');
    Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Sunday','NOT-WORKINGDAY','08:00','16:00');
    
    COMMIT;
    

    create table glas_order
    
    (order_id number
    , order_desc varchar2(100) not null
    , order_type varchar2(10) not null
    , order_date date not null
    , order_ready date
    
    );
    

    Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (1,'order bla','Order1',to_date('07-APR-15 09:00','DD-MON-RR HH24:MI'),to_date('08-APR-15 12:00','DD-MON-RR HH24:MI'));
    Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (2,'order nice','Order1',to_date('14-APR-15 10:00','DD-MON-RR HH24:MI'),to_date('16-APR-15 16:00','DD-MON-RR HH24:MI'));
    Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (3,'order ugly','Order2',to_date('18-APR-15 13:00','DD-MON-RR HH24:MI'),to_date('21-APR-15 09:00','DD-MON-RR HH24:MI'));
    
    COMMIT;
    

    Thank you

    Diana

    Select

    I like order_id

    such as length d

    order_type

    d decode(order_type,'Order1',5,'Order2',8)

    overtime

    of glas_order o

    model

    Reference r on

    (select

    WERKDAG w

    begin_tijd b

    e eind_tijd

    , (to_date (eind_tijd, 'HH24') - to_date (begin_tijd, 'HH24')) * 24 hard

    of ref_workdays

    where soort_werkdag = "WORKINGDAY")

    dimension (w)

    measures (b, e, hard)

    main m

    partition of (order_id I)

    size of (0 n)

    measures (0d, order_date, order_ready, cast (null as varchar2 (10)) as wday, order_type)

    iterate (1e6) rules until (iteration_number > = trunc(order_ready[0]) - trunc(order_date[0])))

    WDAY [0] = to_char (order_date [0] + iteration_number, 'FMDay', 'NLS_DATE_LANGUAGE = ENGLISH')

    , d [0] = d [0] +.

    case

    When trunc(order_date[0]) = trunc(order_ready[0]) - beginning and ready same day

    then presentv (r.b [wday [0]],)

    less (largest (order_ready [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')), to_date (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))

    -bigger (to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI'), least (order_date [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))))

    0) * 24

    When order_date [0] + iteration_number = order_date [0] - first day

    then presentv (r.b [wday [0]],)

    TO_DATE (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]], 'YYYYMMDDHH24:MI')

    -bigger (order_date [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]],'YYYYMMDDHH24:mi'))))

    0) * 24

    When trunc(order_date[0]) + iteration_number = trunc(order_ready[0]) - last day

    then presentv (r.b [wday [0]],)

    less (order_ready [0], to_date (to_char (order_ready [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))

    -to_date (to_char (order_ready [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')

    0) * 24

    of another nvl (r.dur [wday [0]], 0)

    end

    )

    ORDER_ID DURATION ORDER_TYPE OVERTIME
    1 11 Order1 6
    2 22 Order1 17
    3 10 Order2 2

    Rewrittten party rules for readability purposes (more resources)

    measures (0d, order_date, order_ready, cast (null as varchar2 (10)) as to_date (null), (null) to_date, bd, order_type, wday ed)

    iterate (1e6) rules until (iteration_number > = trunc(order_ready[0]) - trunc(order_date[0])))

    WDAY [0] = to_char (order_date [0] + iteration_number, 'FMDay', 'NLS_DATE_LANGUAGE = ENGLISH')

    , comics [0] = to_date (to_char (order_date [0] + iteration_number, 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')

    , ed [0] = to_date (to_char (order_date [0] + iteration_number, 'YYYYMMDD') | r.e [WDAY [0]], 'YYYYMMDDHH24:MI')

    , d [0] = d [0] +.

    case

    When trunc(order_date[0]) = trunc(order_ready[0]) - beginning and ready same day

    then presentv (r.b [wday [0]],)

    less (largest (order_ready [0], [0] bd), ed [0])

    -Greatest (BD [0], least(ORDER_DATE[0],ED[0]))

    0) * 24

    When order_date [0] + iteration_number = order_date [0] - first day

    then presentv (r.b [wday [0]],)

    ED [0]

    -Greatest(ORDER_DATE[0],BD[0])

    0) * 24

    When trunc(order_date[0]) + iteration_number = trunc(order_ready[0]) - last day

    then presentv (r.b [wday [0]],)

    least(order_ready[0],ED[0])

    -bd [0]

    0) * 24

    of another nvl (r.dur [wday [0]], 0)

    end

    )

    Jubilee should be Saturday I guessed.

Maybe you are looking for

  • How can I get rid of im translator?

    Bitch appears at difficult times, and I don't need. I use chrome for translations

  • Portege A100 PPA10A - update the BIOS to boot from a USB device

    Hello I have an old Portege A100, model: PPA10A-0002LP, but I can't seem to find this model on any Web site of Toshiba, closest I've seen is the "PPA10A - 0002 L'. I am wanting to know if there is a BIOS update that will allow me to boot from a USB d

  • Real player video download option not appearing is not since the upgrade to 3.6.6

    Real Player video DOWNLOAD option does not appear with firefox. This has happened Each time Firefox opened == I myself upgraded to 3.6.6

  • Question about audio input on Satellite 1410 304

    Who can help me? I want to connect my discs rotates through an amplifier to my Satellite 1410 304 to digitize my vinyl. I used the helmet on the amplifier output and connected to the audio input on the laptop (microfone entry), but don't get all the

  • Download error

    Graphics for Presario CQ60 101AU driver fails to download completely for windows 7(32 bit), sp45230.exe, display error after only 90% download if direct and if downloaded through bitcomet he complete 100% downloaded but again once goes back to 80% an