Find records overlapping start and end dates

Hi all

I have a table with begin and end date columns. I need to find the records that overlap with a few values in corresponding column.

Table: MG_AUTH_AGNT
-----
ID
MGATH_clnt
MGATH_beg_DT
MGATH_END_DT
MGATH_SERV_GRP
MGATH_STAT
MGATH_TYP
MGATH_NHIC_ERR_CD
-----
I need to find records containing dates that overlap.

Examples of data
-----

If the customer has two records with the same MGATH_SERV_GRP, MGATH_STAT, MGATH_TYP and start and end dates of the first disc are 01/JAN/2009 AND 01 / JAN / 2009.
start and end dates of second record are 15/JAN/2009 and 15/FEB/2009.
Here are the dates overlap. with my select query, I should get these two recordings.

I am using the following query. But it is too slow. Could you please suggest a better sql?
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Select MG_AUTH_AGNT m, MGATH_clnt, MGATH_beg_DT, MGATH_END_DT, MGATH_NHIC_ERR_CD, id where m.MGATH_SERV_GRP = '1' and m.MGATH_STAT = 'A' and MGATH_clnt = (select distinct MGATH_clnt of MG_AUTH_AGNT d where d.MGATH_SERV_GRP = m.MGATH_SERV_GRP and d.MGATH_TYP = m.MGATH_TYP and m.MGATH_CLNT = d.MGATH_CLNT and d.MGATH_STAT = m.MGATH_STAT and m.idd.id ((trunc (m.MGATH_beg_DT) & gt; = trunc (d.MGATH_beg_DT) and trunc (m.MGATH_beg_DT) & lt;=trunc(d.MGATH_END_DT)) or (trunc (m.MGATH_END_DT) & gt; = trunc (d.MGATH_beg_DT) and trunc (m.MGATH_END_DT) & lt; = trunc (d.MGATH_END_DT)) or (trunc (m.MGATH_beg_DT) & lt; = trunc (d.MGATH_beg_DT) and trunc (m.MGATH_END_DT) & gt; = trunc (d.MGATH_END_DT))) MGATH_clnt order MGATH_beg_DT

Published by: user10727414 on March 17, 2009 01:36

user10727414 wrote:
My data is correct

MGSRV_CLNT = MGSRV_BEG_DT = MGSRV_END_DT
501184242 = 28-AUG-07 = 31-DEC-9999
501184242 = 28-AUG-07 = 31-DEC-9999
501184242 = 20-DEC-07 = 31-DEC-9999
501184242 = 20-DEC-07 = 31-DEC-9999

And we had to guess that a year of "99" was in fact "9999" were we? Hang on I'll go and dust off my crystal ball.

Well, now we know the correct dates (?), we'll put that in the original request...

SQL> ed
Wrote file afiedt.buf

  1  with mypeople as
  2  (select 501184242 as id, to_date('28-AUG-2007','DD-MON-YYYY') as stdt, to_date('31-DEC-9999','DD-MON-YYYY') as endt from dual union all
  3   select 501184242, to_date('28-AUG-2007','DD-MON-YYYY'), to_date('31-DEC-9999','DD-MON-YYYY') from dual union all
  4   select 501184242, to_date('20-DEC-2007','DD-MON-YYYY'), to_date('31-DEC-9999','DD-MON-YYYY') from dual union all
  5   select 501184242, to_date('20-DEC-2007','DD-MON-YYYY'), to_date('31-DEC-9999','DD-MON-YYYY') from dual union all
  6   select 2, to_date('19/01/2009','DD/MM/YYYY'), to_date('24/01/2009','DD/MM/YYYY') from dual)
  7  -- END OF TEST DATA
  8  select id, stdt, endt
  9        ,case when lead(stdt) over (partition by id order by stdt,endt) <= endt
 10                or lag(endt) over (partition by id order by stdt,endt) >= stdt then 'Overlap'
 11              else 'Ok'
 12         end as status
 13  from mypeople
 14* order by id, stdt, endt
SQL> /

        ID STDT      ENDT      STATUS
---------- --------- --------- -------
         2 19-JAN-09 24-JAN-09 Ok
 501184242 28-AUG-07 31-DEC-99 Overlap
 501184242 28-AUG-07 31-DEC-99 Overlap
 501184242 20-DEC-07 31-DEC-99 Overlap
 501184242 20-DEC-07 31-DEC-99 Overlap

SQL>

Looks like it works for me.

If it does not work for you then maybe had better give us a statement of create table and insert to your data in the example statements then we can see what you're trying to do.

Tags: Database

Similar Questions

  • Primavera P6 API - start and end dates of the activity in the secondary reference scenario

    How to seek early and dates of activity in the secondary database or tertiary reference end? There are areas of activities and methods provided in planning extraction and primary base line project (active class getBaseline1StartDate(), getBaseline1FinishDate) but can't find any secondary data or tertiary basis even if we show them in details the activity in the Primavera. I use Primavera integration API version 8.2.

    Use the BaselineProjectHelper class to get a list of all the base lines for a given project.  Go through the list looking for basic lines you are interested in.

    Once you have basic interest projects, pull a list of ongoing project activities.

    Browse the list of activities tearing you start and end dates.

    Call the method on each of you loadBaselineActivity of reference projects for the departure of the referenced activity and end dates.

    For performance, seek assistance loadBaselineActivities to reduce database queries.

    V/r,

    Gene

  • Can I add start and end dates to flex in WCS assets?

    Hi all

    I have to add the start and end dates to my flex belt and make it visible on the plus edition + inspect mode. For the Fund, it is STANDARD, but I have an obligation to do so for other assets that is not active promotion.

    Is there any doc/blog I can do? Help, please.

    Hi Avi.

    Dates of start and end standards are OOTB field in the metadata of the asset. So they you must set the cs.sitepreview property in the file futuretense.ini in the 'management '.

    CS.sitepreview = ContentManagement

    You can check out the documentation for more details about this property: futuretense.ini - 11 g Release 1 (11.1.1.8.0)

    If you need something different, maybe you need create your own attributes Start Date and end using types date: Data Design: active models - 11 g Release 1 (11.1.1.8.0)

    Kind regards

    Raul.

  • Simple validation on the start and end dates

    Apex 4.2

    I'm trying to create a script of validation on my start date and end date. A simple validation indicating the start date must be less than the end date. Because apex deals my fields of date as a string, using an expression of pl/sql as P101_START_DATE < = P101_END_DATE does not work. This may seem like an easy question, but I'm unable to create this simple validation. Any help would be greatly appreciated. Thanks in advance!

    Take a look how the TO_DATE plsql function works... ie... to_date(:P101_START_DATE,'mm-DD-yyyy')<=to_date(:P101_END_DATE,'mm-dd-yyyy'),>

  • Calculate the start and end date in Connect By - during Hirerchy changes

    / * Formatted 05/20/2013 09:53 (PS5 v5.115.810.9015) * /.



    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Hello, can you please help me or guide me in the calculation of the dates of beginning and end to the underside of logic

    I want to calculate the Hirerchy Manager to the Agent.
    Then under query works fine and its giving me the expected results
    But when there is a change in the Hirerchy Manager or manager gets promoted
    Then I need to calculate the start date and end date.
    CREATE TABLE PERSON_DTL
    (
      SID                 VARCHAR2(10 BYTE),
      EMP_MGRS_ID         VARCHAR2(10 BYTE),
      START_EFFECTIVE_DT  DATE,
      END_EFFECTIVE_DT    DATE
    );
    
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M100', 'M107', TO_DATE('05/20/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M101', 'M102', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('A100', 'M100', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M100', 'M101', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M107', 'M102', TO_DATE('05/20/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M102', 'M103', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M103', 'M104', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('A101', 'M105', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M105', 'M106', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    SELECT   CONNECT_BY_ROOT (b.sid) agent_sid,
                 TRIM (
                    LEADING ',' FROM    SYS_CONNECT_BY_PATH (b.sid, ',')
                                     || ','
                                     || b.emp_mgrs_id
                 )
                    PATH,
                 START_EFFECTIVE_DT Start_dt,
                 END_EFFECTIVE_DT End_dt
          FROM   PERSON_DTL b
         WHERE   CONNECT_BY_ISLEAF = 1
    START WITH   sid IN ('A101', 'A100')
    CONNECT BY   PRIOR b.emp_mgrs_id = b.sid
    This is the results that i am getting now.
    
    AGENT_SID    PATH                       START_DT    END_DT
    
    A100    A100,M100,M101,M102,M103,M104    1/1/2010    12/31/9999
    A100    A100,M100,M107,M102,M103,M104    1/1/2010    12/31/9999
    A101    A101,M105,M106                   1/1/2010    12/31/9999
    Results Required
    
    A100    A100,M100,M101,M102,M103,M104    1/1/2010    5/18/2013
    A100    A100,M100,M107,M102,M103,M104    5/20/2013   12/31/9999
    A101    A101,M105,M106                   1/1/2010    12/31/9999

    WITH the CLAUSE will make it readable

    SQL> with paths as
      2  (
      3        SELECT   CONNECT_BY_ROOT (b.sid) agent_sid,
      4                 TRIM (
      5                    LEADING ',' FROM    SYS_CONNECT_BY_PATH (b.sid, ',')
      6                                     || ','
      7                                     || b.emp_mgrs_id
      8                 )
      9                  PATH,
     10                 START_EFFECTIVE_DT Start_dt,
     11                 END_EFFECTIVE_DT End_dt,rownum rn
     12        FROM   PERSON_DTL b
     13        START WITH   sid IN ('A101', 'A100')
     14        CONNECT BY   PRIOR b.emp_mgrs_id = b.sid
     15  ),
     16  flagged as
     17  (
     18      select agent_sid,
     19             path,
     20             start_dt,
     21             end_dt,rn,
     22             case when path like lag(path) over(order by rn)||'%' then 0 else 1 end flg
     23      from paths
     24  ),
     25  summed as
     26  (
     27      select agent_sid,path,start_dt,end_dt,
     28             sum(flg) over(order by rn) sm
     29      from flagged
     30  )
     31  select agent_sid,max(path) path,max(start_dt) start_dt,
     32         min(end_dt) end_dt
     33  from summed
     34  group by agent_sid,sm
     35  order by agent_sid;
    
    AGENT_SID  PATH                                     START_DT  END_DT
    ---------- ---------------------------------------- --------- ---------
    A100       A100,M100,M101,M102,M103,M104            01-JAN-10 18-MAY-13
    A100       A100,M100,M107,M102,M103,M104            20-MAY-13 31-DEC-99
    A101       A101,M105,M106                           01-JAN-10 31-DEC-99
    
  • Start and end date of week 1-5 a month

    I wanted to print the date of beginning and end of the week for a given month.  If the month last_week overlaps the next month, I don't want to print the week5. If the week5 overlap with next month, then it must be printed.

    SELECT

    TRUNC (to_date(:P_DATE,'MM/DD/YYYY'), 'IW') 'SW1', / * start of week 1 * /.

    TRUNC (TO_DATE (: P_DATE, "MM/DD/YYYY '") + 6, 'IW')-1 'EW1', / * end of week you 1 * /.

    NEXT_DAY (trunc (to_date(:P_DATE,'MM/DD/YYYY'), 'IW'), 'Monday') 'SW2 '.

    NEXT_DAY (TRUNC (TO_DATE (: P_DATE, "MM/DD/YYYY") + 6, 'IW'), 'Sunday') 'EW2. "

    NEXT_DAY (NEXT_DAY (trunc (to_date(:P_DATE,'MM/DD/YYYY'), 'IW'), 'Monday'), 'Monday') "SW3."

    NEXT_DAY (NEXT_DAY (TRUNC (TO_DATE (: P_DATE, "MM/DD/YYYY") + 6, 'IW'), 'Sunday'), 'Sunday') 'EW3. "

    NEXT_DAY (NEXT_DAY (NEXT_DAY (trunc (to_date(:P_DATE,'MM/DD/YYYY'), 'IW'), 'Monday'), 'Monday'), 'Monday') "SW4".

    NEXT_DAY (NEXT_DAY (NEXT_DAY (TRUNC (TO_DATE (: P_DATE, "MM/DD/YYYY") + 6, 'IW'), 'Sunday'), 'Sunday'), 'Sunday') 'EW4. "

    NEXT_DAY (NEXT_DAY (NEXT_DAY (NEXT_DAY (trunc (to_date(:P_DATE,'MM/DD/YYYY'), 'IW'), 'Monday'), 'Monday'), 'Monday'), 'Monday') 'SW5. "

    NEXT_DAY (NEXT_DAY (NEXT_DAY (NEXT_DAY (TRUNC (TO_DATE (: P_DATE, "MM/DD/YYYY") + 6, 'IW'), 'Sunday'), 'Sunday'), 'Sunday'), 'Sunday') 'EW5.

    FROM DUAL;

    SW1 EW1 SW2 EW2 SW3 EW3 SW4 EW4 SW5 EW5
    29/12/201404/01/201505/01/201511/01/201512/01/201518/01/201519/01/201525/01/201526/01/201501/02/2015

    Is it possible to get it without using the next_day() several times for each week and to limit the accumulation of the week last in a month.

    Check my last answer. And if this isn't what you need, then the expected results for each month in 2015.

    SY.

  • Start and end Date Validation

    OK I'm lost and sought and made changes to what I do, but not sure I correct datasets or written something wrong.

    I have two date fields in my form. A Start Date and an end Date

    I put a validation that indicates the Start Date/time cannot be greater than the end Date/time or so I think that's what he said. But if I put and a date in the form of an hour after the beginning of end date, it throws the error

    Here are my details and maybe I'm just storing data wrong or something


    Validation ENDDATE: PL/SQL error:
    If to_date(:P6_DTGSTART) > to_date(:P6_DTGEND)
    raise_application_error (-20001, 'End Date must be greater than the Start Date.');
    end if;

    When I look at the data stored in the database SQL Workshop, this is what I see
    DTGSTART 11-29-2010
    DTGEND


    The entry in the form is a DatePicker to the format: DD-MON-YYYY HH24
    If the entry as well as:

    Start date/time November 29, 2010 09:25
    End date/time November 29, 2010 10:25

    The end date may be on the same date, but time must be greater than the start date/time

    Thank you
    Wally

    Check it out now...

    Thank you
    Machaan

  • Shifts start and end date

    Hello

    I have an obligation to make the fiscal quarters following the date of beginning and end given.
    For example if I have

    start date: 1 January 09
    end date: 31 December 09

    I divide it into 4 quarters as below:

    T1: 1 January 09-31 March 09
    Qtr2: 1 April 09-30 June 09
    Qtr3: 1 July 09-30 September 09
    Qtr4: 1st October 09-31 December 09

    Help, please.

    Kind regards
    Fahim

    Hello

    SQL> SELECT ADD_MONTHS(to_date('01-JAN-2008','DD-MON-YYYY'),(ROWNUM-1)*3) start_dt,(ADD_MONTHS(to_date('01-JAN-2008','DD-MON-YYYY'),ROWNUM*3))-1 End_Date
      2  FROM DUAL
      3  CONNECT BY ADD_MONTHS(to_date('01-JAN-2008','DD-MON-YYYY'),(LEVEL-1)*3) <=to_date('30-SEP-2009','DD-MON-YYYY');
    
    START_DT  END_DATE
    --------- ---------
    01-JAN-08 31-MAR-08
    01-APR-08 30-JUN-08
    01-JUL-08 30-SEP-08
    01-OCT-08 31-DEC-08
    01-JAN-09 31-MAR-09
    01-APR-09 30-JUN-09
    01-JUL-09 30-SEP-09
    
    7 rows selected.
    
    SQL>
    

    See you soon,.

  • Alternate greeting - start and end date

    We have 8.6 connection of the unit. I know alternate greetings may have end dates, but our users also want the start dates. Is this possible? I have not seen it mentioned anywhere, but I thought I would check before giving up on this subject.

    Unfortunately not.

    Chris

  • Get start and end date of week by month and year

    How I need the week is here - a week always begins on a Sunday so from February, it will be

    begin the week of end of week

    12-02-1 02/12/04
    02/12/05 02/12/11
    02/12/12-02/12/18
    02/12/19 02/12/25
    02/12/26-29/12/29

    So, because the first week does not start on a Sunday he's leaving

    1 (Wednesday) to 4th (saturday) just like a calendar.

    Thanks in advance

    If far from Solomons help I have this




    This is for January
    WITH t AS)
    SELECT TRUNC (TRUNC (to_date('01-01-12','MM-DD-YY'), 'YYYY')-1, 'W') + (LEVEL-1) * 7 week_start_date
    OF THE DOUBLE
    CONNECT BY LEVEL < = 53
    )
    SELECT week_start_date,
    LEAST (LAST_DAY (to_date('01-01-12','MM-DD-YY')), week_start_date + 6) week_end_date
    T
    WHERE week_start_date > = TRUNC (to_date('01-01-12','MM-DD-YY'), 'MM')
    AND week_start_date < ADD_MONTHS (TRUNC (to_date('01-01-12','MM-DD-YY'), 'MM'), 1)


    begin the week of end of week
    01/12/02-01/12/08
    12/01/09-01/12/15
    12/01/16-01/12/22
    01/12/23-01/12/29
    01/12/30-01/12/31

    If satrts Sunday of the week:

    WITH t AS (
               SELECT TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 week_start_date
                FROM  DUAL
                CONNECT BY TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 <= LAST_DAY(&dt)
              )
    SELECT  GREATEST(week_start_date,TRUNC(&dt,'MM')) week_start_date,
            LEAST(LAST_DAY(&dt),week_start_date + 6) week_end_date
      FROM  t
      WHERE week_start_date <= LAST_DAY(&dt)
    /
    

    For example:

    SQL> SET VERIFY OFF
    SQL> DEFINE dt="DATE '2012-01-17'" -- January
    SQL> WITH t AS (
      2             SELECT TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 week_start_date
      3              FROM  DUAL
      4              CONNECT BY TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 <= LAST_DAY(&dt)
      5            )
      6  SELECT  GREATEST(week_start_date,TRUNC(&dt,'MM')) week_start_date,
      7          LEAST(LAST_DAY(&dt),week_start_date + 6) week_end_date
      8    FROM  t
      9    WHERE week_start_date <= LAST_DAY(&dt)
     10  /
    
    WEEK_STAR WEEK_END_
    --------- ---------
    01-JAN-12 07-JAN-12
    08-JAN-12 14-JAN-12
    15-JAN-12 21-JAN-12
    22-JAN-12 28-JAN-12
    29-JAN-12 31-JAN-12
    
    SQL> SET VERIFY OFF
    SQL> DEFINE dt="DATE '2012-02-25'" -- February
    SQL> WITH t AS (
      2             SELECT TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 week_start_date
      3              FROM  DUAL
      4              CONNECT BY TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 <= LAST_DAY(&dt)
      5            )
      6  SELECT  GREATEST(week_start_date,TRUNC(&dt,'MM')) week_start_date,
      7          LEAST(LAST_DAY(&dt),week_start_date + 6) week_end_date
      8    FROM  t
      9    WHERE week_start_date <= LAST_DAY(&dt)
     10  /
    
    WEEK_STAR WEEK_END_
    --------- ---------
    01-FEB-12 04-FEB-12
    05-FEB-12 11-FEB-12
    12-FEB-12 18-FEB-12
    19-FEB-12 25-FEB-12
    26-FEB-12 29-FEB-12
    
    SQL> SET VERIFY OFF
    SQL> DEFINE dt="DATE '2012-03-07'" -- March
    SQL> WITH t AS (
      2             SELECT TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 week_start_date
      3              FROM  DUAL
      4              CONNECT BY TRUNC(TRUNC(&dt,'MM') + 1,'IW') - 1 + (LEVEL - 1) * 7 <= LAST_DAY(&dt)
      5            )
      6  SELECT  GREATEST(week_start_date,TRUNC(&dt,'MM')) week_start_date,
      7          LEAST(LAST_DAY(&dt),week_start_date + 6) week_end_date
      8    FROM  t
      9    WHERE week_start_date <= LAST_DAY(&dt)
     10  /
    
    WEEK_STAR WEEK_END_
    --------- ---------
    01-MAR-12 03-MAR-12
    04-MAR-12 10-MAR-12
    11-MAR-12 17-MAR-12
    18-MAR-12 24-MAR-12
    25-MAR-12 31-MAR-12
    
    SQL> 
    

    SY.

    Published by: Solomon Yakobson, January 12, 2012 13:19

  • Search based on the start date and end date

    Hello

    I added two fields "Start Date" and "End Date" on a search page.
    I did the VO extension also.
    Now, I have to implement the logic of the search to get all records created between' start' and 'End Date' after pressing the "GO" button on this page.

    Can someone please provide advice to extend the controller.

    Thanks in advance.


    Gaurav.

    I think that the path would be

    Import oracle.apps.per.common.webui.PerTransactionTopCOImpl;

    Thank you
    -Anil
    http://oracleanil.blogspot.com/

  • Breaking a year in coming weeks of beginning and end Dates (parameters) and first and last day of the month

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    SELECT first_thursday + (7 * (LEVEL - 1))   AS week_start_date,
                     first_thursday + (7 * LEVEL) - 1    AS  week_end_date
    FROM
    (
      SELECT TRUNC(p_from_date + 4, 'IW') - 4   AS first_thursday, -- Week should start the pre ceeding THURSDAY based on the Start Date
                      TRUNC( p_to_date + 4,  'IW') - 5     AS last_wednesday
      FROM
      (
        SELECT to_date('01-JAN-2013') AS p_from_date,
                        NVL(to_date('31-DEC-2013'), SYSDATE) AS p_to_date
        FROM     dual
      ) parms
    ) end_points
    CONNECT BY LEVEL <= ( last_wednesday + 1 - first_thursday)/7;
    

    Currently, this is the result I get (I'm only including the months of January and December here).

    Week_Start_Date     Week_End_Date
    27-DEC-12                02-JAN-13
    03-JAN-13                 09-JAN-13
    10-JAN-13                 16-JAN-13
    17-JAN-13                 23-JAN-13
    24-JAN-13                 30-JAN-13
    31-JAN-13                 06-FEB-13
    

    December:

    28-NOV-13               04-DEC-13
    05-DEC-13              11-DEC-13
    12-DEC-13              18-DEC-13
    19-DEC-13              25-DEC-13
    

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    01-JAN-13              02-JAN-13
    03-JAN-13              09-JAN-13
    10-JAN-13             16-JAN-13
    17-JAN-13             23-JAN-13
    24-JAN-13             30-JAN-13
    31-JAN-13             31-JAN-13
    

    February:

    01-FEB-13    06-FEB-13
    07-FEB-13    13-FEB-13
    14-FEB-13    20-FEB-13
    21-FEB-13    27-FEB-13
    28-FEB-13    28-FEB-13
    

    November:

    31-OCT-13    06-NOV-13
    07-NOV-13    13-NOV-13
    14-NOV-13    20-NOV-13
    21-NOV-13    27-NOV-13
    28-NOV-13    04-DEC-13
    

    December:

    01-DEC-13           04-DEC-13
    05-DEC-13           11-DEC-13
    12-DEC-13          18-DEC-13
    19-DEC-13          25-DEC-13
    26-DEC-13          31-DEC-13
    

    Hello

    Roxyrollers wrote:

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    1. First_thursday SELECT + (7 * (LEVEL - 1)) AS week_start_date,
    2. first_thursday + (7 * LEVEL)-1 AS week_end_date
    3. Of
    4. (
    5. SELECT TRUNC (p_from_date + 4, 'IW') - 4 AS first_thursday,-week should start to perform the pre-mounted THURSDAY based on the Start Date
    6. TRUNC (p_to_date + 4, 'IW') - 5 AS last_wednesday
    7. Of
    8. (
    9. SELECT to_date('01-JAN-2013') AS p_from_date,
    10. NVL (to_date('31-Dec-2013'), SYSDATE) AS p_to_date
    11. OF the double
    12. ) parms
    13. ) end_points
    14. CONNECT BY LEVEL<= (="" last_wednesday="" +="" 1="" -="">

    Currently, this is the result I get (I'm only including the months of January and December here).

    1. Week_Start_Date Week_End_Date
    2. DECEMBER 27, 12 2 JANUARY 13
    3. JANUARY 3, 13 JANUARY 9, 13
    4. 10 JANUARY 13 JANUARY 16, 13
    5. 17 JANUARY 13 23 JANUARY 13
    6. 24 JANUARY 13 30 JANUARY 13
    7. 31 JANUARY 13 FEBRUARY 6, 13

    December:

    1. NOVEMBER 28, 13 4 DECEMBER 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    1. JANUARY 1, 13 2 JANUARY 13
    2. JANUARY 3, 13 JANUARY 9, 13
    3. 10 JANUARY 13 JANUARY 16, 13
    4. 17 JANUARY 13 23 JANUARY 13
    5. 24 JANUARY 13 30 JANUARY 13
    6. 31 JANUARY 13 JANUARY 31, 13

    February:

    1. 1ST FEBRUARY 13 FEBRUARY 6, 13
    2. 7 FEBRUARY 13 FEBRUARY 13, 13
    3. 14 FEBRUARY 13 FEBRUARY 20, 13
    4. 21 FEBRUARY 13 FEBRUARY 27, 13
    5. 28 FEBRUARY 13 FEBRUARY 28, 13

    November:

    1. 31 OCTOBER 13 NOVEMBER 6, 13
    2. 7 NOVEMBER 13 NOVEMBER 13, 13
    3. 14 NOVEMBER 13 NOVEMBER 20, 13
    4. 21 NOVEMBER 13 NOVEMBER 27, 13
    5. NOVEMBER 28, 13 4 DECEMBER 13

    December:

    1. 1ST DECEMBER 13 DECEMBER 4, 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13
    5. 26 DECEMBER 13 DECEMBER 31, 13

    Why the "weeks" in November, have all 7 days, while the "weeks" in the first or the last week in the other month usually have less?  (For example, February 28 is a 'week' alone.)

    The following works for the other months:

    WITH all_days AS

    (

    SELECT DATE "2013-01-01' + LEVEL - AS a_date 1

    OF the double

    CONNECT BY LEVEL<=>

    )

    SELECT DISTINCT

    More GRAND (TRUNC (a_date + 4, 'IW') - 4)

    , TRUNC (a_date, 'MONTH')

    ) AS week_begin

    , The LEAST (TRUNC (a_date + 4, 'IW') + 2

    TRUNC (LAST_DAY (a_date))

    ), Week_end

    Of all_days

    ORDER BY week_begin

    ;

    Output:

    WEEK_BEGIN WEEK_END

    ----------- -----------

    January 1, 2013 January 2, 2013

    January 3, 2013 January 9, 2013

    January 10, 2013 January 16, 2013

    January 17, 2013 January 23, 2013

    January 24, 2013 January 30, 2013

    January 31, 2013 January 31, 2013

    February 1, 2013 February 6, 2013

    February 7, 2013 February 13, 2013

    February 14, 2013 February 20, 2013

    February 21, 2013 February 27, 2013

    February 28, 2013 February 28, 2013

    ...

    November 1, 2013 November 6, 2013

    November 7, 2013 November 13, 2013

    November 14, 2013 November 20, 2013

    November 21, 2013 November 27, 2013

    November 28, 2013 November 30, 2013

    December 1, 2013 December 4, 2013

    December 5, 2013 December 11, 2013

    December 12, 2013 December 18, 2013

    December 19, 2013 December 25, 2013

    26 December 2013 31 December 2013

  • "When I import the xls file its start and finish dates to date of data change.

    I'm using Primavera p6 v7 autonomous, I export project in excel sheet and I put my activities with start and end dates it. When I import this sheet in primavera the start and finish dates change to date of data...

    Can someone guide me and suggest me what should I do to solve this problem...

    You insert the logic successor/predecessor for these activities. What, exactly, are these activities? If you want an activity at the start/finish on a specific date, you can always use a constraint.

  • Include the expected start Date and end Date for the management of SSHRC-Absence

    Is it possible to include the scheduled Start Date and end Date of project to SSHRC, management of absences with the type of leave is confirmed?

    Thanks in advance

    Hello

    In this case, you should disable the option the absence request, so that by default all sheets are confirmed and the user do not have to apply once leave as planned and then comply.

    You can see the id metalink - "How do I disable the State of Absence of R12 Absence Management Page [ID 786691.1]" to understand how to disable "Planned" option to request authorization for simple customization.

    It will be useful.

    Thank you
    Sanjay

  • Grouping based on start and end of year

    Hi all

    Need your help to solve a SQL query

    My data like this look

    year of CID rid
    52 1000 2001 1
    52 1000 2002 1
    52 1000 2003 6
    52 1000 2004 6
    52 1000 2005 6
    52 1000 2007 1
    52 1001 2003 1
    52 1001 2004 1
    52 1001 2005 1
    52 1001 2006 3
    52 1001 2007 3

    I need to produce the output is

    CID RID TITLE START AND END
    52 1000 2001 - 2002 1
    52 1000 2003 - 2005 6
    52 1000 2007 - 2007 1
    52 1001 2003 - 2005 1
    52 1001 2006 - 2007 3
    -----------
    Here's the script for the table and data

    create table T)
    CID NUMBER,
    rid the NUMBER,
    start_year NUMBER,
    title NUMBER
    );

    Insert into t (cid, RID, start_year, title) values (52, 1000, 2001, 1).
    Insert into t (cid, RID, start_year, title) values (52, 1000, 2002, 1).
    Insert into t (cid, RID, start_year, title) values (52, 1001, 2003, 1);
    Insert into t (cid, RID, start_year, title) values (52, 1000, 2003, 6);
    Insert into t (cid, RID, start_year, title) values (52, 1001, 2004, 1);
    Insert into t (cid, RID, start_year, title) values (52, 1000, 2004, 6);
    Insert into t (cid, RID, start_year, title) values (52, 1001, 2005, 1).
    Insert into t (cid, RID, start_year, title) values (52, 1000, 2005, 6);
    Insert into t (cid, RID, start_year, title) values (52, 1001, 2006, 3);
    Insert into t (cid, RID, start_year, title) values (52, 1001, 2007, 3);
    Insert into t (cid, RID, start_year, title) values (52, 1000, 2007, 1);

    commit;

    I managed to go as far (some as close to what I need but not exactly what I need)

    Select the title, max (year1), min (year2), cid, RID
    de)
    Select tc.cid, tc.rid, tc.title, tc.start_year year1, year2, tp.start_year, decode (tc.title, tp.title, 'n', 'Y') gap
    t tc,.
    t tp
    where tc.start_year - 1 = tp.start_year
    and tc.cid = tp.cid
    and tc.rid = tp.rid
    )
    Cid group, RID, title, gap


    Thank you for thinking

    Ngoyi,

    Houston-Texas

    Hi, Ngoyi,

    Here's one way:

    WITH      got_grp_id     AS
    (
         SELECT     cid, rid, start_year, title
         ,     ROW_NUMBER () OVER ( PARTITION BY  cid, rid
                                   ORDER BY          start_year
                           )
               -     ROW_NUMBER () OVER ( PARTITION BY  cid, rid, title
                                   ORDER BY          start_year
                           )         AS grp_id
         FROM    t
    )
    SELECT       cid
    ,       rid
    ,       MIN (start_year) || '-'
                            || MAX (start_year)     AS start_end
    ,       title
    FROM       got_grp_id
    GROUP BY  cid, rid, title, grp_id
    ORDER BY  cid, rid, start_end
    ;
    

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.
    Still, it would be more useful if the sample data and the results don't always have the same value in a column. I'm just guessing at what cid and get rid of play in this problem.
    Also, thanks for posting your request. It helps to understand the problem.

    For an explanation of the technique of Difference sets used in the above query, see {message: id = 9953384} and/or {message: id = 9956917}

    Published by: Frank Kulash, March 23, 2012 13:34

Maybe you are looking for

  • iPhone drop

    I dropped my iPhone 6 in my room (in a way quite hard). He had a spot clear case and a glass screen protector which was protecting her pretty good... I pulled it out to check it out and jumped to the middle of the screen. I jumped back in and everyth

  • 7610: HP 7160 does not print envelope

    I recently replaced my Brother with a HP7610 printer and all is well until I had envelopes printing Word 2007 in Windows 10. The printer raises the DL envelopes and transmits them to the output tray, but nothing prints on envelopes. I have not change

  • Sansa has changed your packaging?

    I begin to doubt the sansa clip + I just bought to be false. The inner plastic box is not sealed and seems different. The packaging is the data connector is still pink. And there is no CD. Wanted to contact customer service, but live chat is closed t

  • printer offers blanks

    Printer-Canon mp450 - looks like its printing, but pages are blank.

  • HP 3210 I want to only print in blue

    I have a HP 3210 all-in-one, wireless, with MacBook Pro.  How to print a black & white line in blue drawing only?