How to find out the names which have overlapping times

Hello:
I've a table which contains some names and their calling time period. I need to find out which of those names have overlapping time period.
Name|StartTime|EndTime
A|26/3/2011 12:33:16 PM|26/3/2011 12:40:10 PM
A|26/3/2011 12:41:28 PM|26/3/2011 12:43:19 PM
A|26/3/2011 12:42:28 PM|26/3/2011 12:47:50 PM
B|26/3/2011 10:22:28 PM|26/3/2011 10:50:10 PM
B|26/3/2011 10:49:28 PM|26/3/2011 10:53:50 PM
B|26/3/2011 10:50:28 PM|26/3/2011 10:59:50 PM
B|26/3/2011 10:59:58 PM|26/3/2011 11:10:50 PM
C|26/3/2011 11:05:58 PM|26/3/2011 11:10:50 PM
C|26/3/2011 11:40:58 PM|26/3/2011 11:50:50 PM
I need those names which have multiple calls and one call starts before the end of another call. If anyone have four calls and two of those overlapped (A has two overlapping and B has three overlapping), that name should also come into my list like below:
Name|Overlapping_Count
A|1
B|2
Can anyone help me please?
Thanks/Razin

Thans for pointing out the error in my post. It seems, being rather busy in this period, I'm starting to wear out as I missed the fact the overlaps would be returned twice. :(
I had in mind a more general case where as single row overlaps with more than one other row.
The OP's data contained one to one overlaps only and it seems no generalized approach was needed.
with
the_data as
(select 'A' name,to_date('26/03/2011 12:33:16','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:40:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'A' name,to_date('26/03/2011 12:41:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:43:19','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'A' name,to_date('26/03/2011 12:42:20','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:42:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'A' name,to_date('26/03/2011 12:42:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:47:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:22:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:50:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:49:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:53:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:50:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:59:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:59:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'C' name,to_date('26/03/2011 11:05:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'C' name,to_date('26/03/2011 11:40:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:50:50','dd/mm/yyyy hh24:mi:ss') end_time from dual
select name,count(distinct overlap) overlapping_count
  from (select x.name,to_char(greatest(x.start_time,y.start_time),'yyyymmddhh24miss')||'|'||to_char(least(x.end_time,y.end_time),'yyyymmddhh24miss') overlap
          from the_data x,the_data y
         where x.name = y.name
           and greatest(x.start_time,y.start_time) < least(x.end_time,y.end_time)
           and x.start_time != y.start_time
           and x.end_time != y.end_time
group by name
order by name
with
the_data as
(select 'A' name,to_date('26/03/2011 12:33:16','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:40:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'A' name,to_date('26/03/2011 12:41:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:43:19','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'A' name,to_date('26/03/2011 12:42:20','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:42:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'A' name,to_date('26/03/2011 12:42:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:47:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:22:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:50:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:49:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:53:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:50:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:59:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'B' name,to_date('26/03/2011 10:59:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'C' name,to_date('26/03/2011 11:05:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
select 'C' name,to_date('26/03/2011 11:40:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:50:50','dd/mm/yyyy hh24:mi:ss') end_time from dual
t as
(select name,
        case when max(end_time) over(partition by name order by start_time,end_time rows between unbounded preceding and 1 preceding) > start_time
             then 0
             else 1
        end start_of_group
  from  the_data
select  name,
        count(*) overlapping_count
  from  t
where start_of_group = 0
group by name
order by nameRegards
Etbin

Similar Messages

  • How to find out the rows inserted between a time period.

    Hi,
    Please help me to solve this.
    Table - emp.
    Colmns - empno(Primary Key),ename, mgr
    How to find out the rows inserted between a time period.
    For eg:- Between 02-Oct-2006 1 PM and 03-Oct-2006 2 PM.
    regards,
    Mathew.

    Hi,
    Maybe work:
    For each row, ORA_ROWSCN returns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides
    e.g.:
    SGMS@ORACLE10> create table test(cod number);
    Table created.
    SGMS@ORACLE10> insert into test values (1);
    1 row created.
    SGMS@ORACLE10> insert into test values (2);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> insert into test values (3);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> select SCN_TO_TIMESTAMP(ora_rowscn),ora_rowscn,cod from test;
    SCN_TO_TIMESTAMP(ORA_ROWSCN)       ORA_ROWSCN        COD
    06/11/06 08:56:56,000000000         727707205          1
    06/11/06 08:56:56,000000000         727707205          2
    06/11/06 08:57:05,000000000         727707210          3Cheers

  • How to find out the columns which has 16 digit credit card number

    Hi All,
    I have a requirement where in i need to find out the columns which has 16 digit credit number in it and create a report with owner, table name and column name.
    The issue is that the credit card number can be entered in any columns of any table of any schema. For example the credit card number can be entered in any description field(eg: The number is 4001412134642881), in that case i need to filter only the numbers and do the LUHN check to validate the credit card number.
    Please provide me a suggestion on how to scanl the values of all the columns to know the column which has credit card number.
    Regards,
    Raj.

    Tell me this - how the hell do you have a database with credit card number data and NOT know which columns of which tables contain credit card numbers? (and how on earth is this data NOT encrypted!?)
    How is what you want to do, NOT a fishing expedition to hack a database that may or may not be storing credit card details?
    And do you honestly think that we should simply trust that once you have extracted these numbers, performed a Luhn algorithm to verify these as credit card numbers, you are not going to fraudulently use these credit card numbers!?
    I have marked your posting as an attempt to hack an Oracle database for fraudulent use of credit card data. I hope that your OTN account is terminated soon and trust that your too much of a coding idiot to actually succeed in this endevour.

  • How to find out the name of a table?

    Hi
    How can I find out the name of a table which doesn't have a record history?
    Regards
    Rahman

    No direct way to know the tables. What you will find on the ABout this page link are the View Object (similar to record sets), Entity objects, controller and Application module. Generally EO is based on a table or the VO can be based on the query which you can find the corresponding xml file. But a button action might be calling a method in AM or CO which in turn call some wrapper method to interact with database. So nothing straight forward. You will have to analyze the all page related code objects.
    They are specific to OA framework and if you are not aware about them, better go through the initial chapters of OAF dev guide.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to find out the values which are assigned in authority group

    Hi to all
    Please tell me where can I find out the values which are assigned in authority object according to roles.
    for ex :
             Changed    Customer: Account Authorization                              F_KNA1_BED
              Changed    Customer: Account Authorization                              T-DR50175601
                Activity                       01, 02, 03, 08                                                              ACTVT
                Authorization Group            5100                                                                        BRGRU
    F_KNA1_BED is the authority object , assigned to one user.
    He can access the authorization group 5100. I want to check that value in my program.
    How ?
    Where it is stored.
    Please help me....
    Regards
    Anubhav Gupta

    Hi Anubhav,
    Please use this FM "SUSR_USER_AUTH_FOR_OBJ_GET" and pass the object name in it . You would get the values for that particular object.
    Thanks
    Nitin Sachdeva

  • How to Find out the Name of the Table in Data Sources

    Hi All,
    How Can i find out the table names used in data Sources.
    For EX. Suppose I want to find out the table Names  in R3 Used In GL Data Source 0FI_GL_4.
    Thanks in Advance.
    Vaibhav A

    Hi,
    Usefull link:
    https://wiki.sdn.sap.com/wiki/display/BI/BW%20SD%20MM%20FI%20DATASOURCES
    Regards.

  • How to find out the name of the executable

    hi,
    say, i have an executable jar called Hello.jar. how do i know the name "Hello.jar" in main() when the executable jar is launched.
    that is, if i rename Hello.jar to HelloWorld.jar, how can main() know about this? this matters because i want to run the app
    in a separate process, which requires the name of the application.
    thanks

    yes to question 1: because i'm calling into a dll through jni to display a screensaver in the preview window. not spawning a separate process causes windows to hang for a while before
    the screensaver is displayed. the new process is passed arguments that are checked by main() so that another process won't be created (no infinite recursions).
    thanks.

  • How to find out the line which caused the runtime error in a SP?

    We have a situation like this.
    We are consulting company doing consultancy services on Oracle technologies.
    One of our clients have PL/SQL stored package.
    We found out by debugging the Oracle Forms front-end application that
    error is generated by a procedure inside this package.
    Problem is that this procedure has over 6000 lines.
    How do we figure out the line which caused the error?
    We tried putting messages in between, but not have been successful.
    Any help would be greatly appreciate.

    How do we figure out the line which caused the error?
    We tried putting messages in between, but not have been successful.
    What does that mean exactly?
    Typically you would instrument the code (especially for multi-step ETL/transform processes) to capture/log key information.
    Also, key sections of code would also be in their own BEGIN/EXCEPTION/END block so that you would know what block caused the exception.
    step_num NUMBER; -- what step is being executed?
    BEGIN
      step_num := 1;
      . . . do something
      step_num := 2;
      . . .  do something else
    EXCEPTION
      -- when you get here the 'step_num' variable will have the number of the step that caused the exception. Log it and then handle/reraise it.
    END;

  • How to find out the names of front-end servers in Apps ?

    Hi,
    In the setup wherein we have mutiple front end servers (Apache running on all nodes, CM running on one of them, Forms server running on one/more of them etc ..) is there any way to know the node-names ?
    FND_NODES table lists only the CM node name
    FND_APPLICATION_SERVERS from 11.5.9 onwards doesnt have any info I guess
    What is the find this out
    Thanks

    "wherever the parameter is set to YES it means this is the node you are looking for "My question is
    I do not know the node names itself
    And thats what I am looking for
    We have very huge setup with mutiple instances and I was not part of the implementation team
    Each Apps instance has about 4 or 5 front ends. They are in the farm setup over the NAS
    I need to know the names of these 4 / 5 servers for each instance
    Apart from asking the senior / old-timer DBAs in the team or the documentation or asking sysadmins, is there any way from the 11i Apps metadata information, I can get this info
    FND_NODES in this farm type of setup just shows the name of the load balancer virtal server to which all these 4 or 5 servers point to
    But not the actual names of the servers

  • How to Find out the from which table we can get the following fields?

    The following fields are from invoice data
    How to  know or from which table we get the following fields:
    Header Details:
    Manifest:, Finance Control #:, Alternate SID:, Carrier:, Container/Trailer #:, Hazmat Code:, Harmonizing Code, Freight Forwarder, Fiscal Rep., Ship From,  Notify Party
    Item Details:
    VAT/Tax Rate %, VAT/Tax Amount, Measurements, Net Weight, Gross Weight
    thanks

    Dear Krishnama
    Place your mouse on the required fields and press F1.  A box with header Performance Assistant will appear in front of you where you select "Technical information" (icon like hammer and spanner). 
    You can now see what table it is.
    thanks
    G. Lakshmipathi

  • How to find out the primary and failover DNS name

    Hi;
    This sounds very stupid, but could some one please tell me how to find out the name/dns name of the primary and failover server without using the CDS console.
    any help is appreciated

    Is this what you want?
    $ /usr/lib/ldap/ldap_cachemgr -g
    cachemgr configuration:
    server debug level 0
    server log file "/var/ldap/cachemgr.log"
    number of calls to ldapcachemgr 12729
    cachemgr cache data statistics:
    Configuration refresh information:
    Previous refresh time: 2005/08/07 23:54:59
    Next refresh time: 2005/08/08 00:55:00
    Server information:
    Previous refresh time: 2005/08/14 15:15:00
    Next refresh time: 2005/08/15 03:15:00
    server: ldap1.example.com, status: UP
    server: ldap2.example.com, status: UP
    server: ldap3.example.com, status: UP
    Cache data information:
    Maximum cache entries: 256
    Number of cache entries: 0
    Gary

  • How to find out the failed reorg tables during reorgnization phase

    Dear All,
      I am doing the archiving project.
      I have finished the Write phase and Delete Phase.
      Now I am doing the tablespace(PSAPSR3) reorganization in QAS(Offline).
      Due to the redo log space was full during the reorgnization phase.
      Some tables' reorgnization progress were failed.
      Hope you could tell me how to find out the tables which reorgnization were failed.
      (DB level?  OS level? SAP Level?)
    Thank you in advance!
    Jason

    /oracle/QAS/sapreorg

  • Find out the name of the info cube with the query name

    hey,its a very general question..how to find out the name of the infocube or ods if we have the name of the query...and how far is sq01 helpful for this...thanks..

    Tom,
    There are many ways... but, SQ01 is not one of them (unless someone has built a query for that).
    1) Transaction RSRT, paste the technical name of the query, and hit enter. InfoProvider name will be inserted by the system.
    2) Open the query in BEx and look at the properties.
    3) Metadata Repository
    4) Table RSRREPDIR

  • How to find out the batches released from ASCP

    hello gurus,
    Please let me know how to find out the batches which is released from the ASCP in the OLTP OPM instance, like for the Discrete in the WIP Order in the others tabe we can see that there will be a message like " Job mass loadded on......". So is there any way that we can findout whether the batch is released from the ASCP or is it manually created.
    Thanx & Regards

    Hi,
    You can check it in SM59 if there are any RFC destinations for the above systems.
    Alternatively ,check the table RFCDEST if any entries are maintained
    Regards,
    Lakshman.

  • How to find out the Target Component name and Target view name

    Hi All Expert,
                      I want to know ,how to find out the target component and target view in WEB UI,when i click on a field which shows as a hyper link in WEB UI .At GUI level ,i know the how it will work.Any way to find out the component name and view name which is show the details of that field at GUI level .IF you go to transaction CRMD_ORDER then open the service contract id .then goto the item level value .there is 1 service data tab is available at item level.there is two button is available.first one is available time and second one is response time .if i click on any button then one popup is open which is shows the details of that button.I dont know how to find out the component name and view name from GUI level.
    Thanks in Advance....
    Vishwas Sahu

    Hi Vishwa,
                 The control would be something like this for navigation in Get_p_xxx method u mention as link and u mention a event name which gets triggered on the click of this hyperlink. So your GET_P_XXX method would have the following code:
    CASE iv_property.
        WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
          rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
        WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
          rv_value = 'EXAMPLE'.
    Now you have to create a method as EH_ONEXAMPLE at your IMPL class and within which you would give an outbound plug method. Within the outbound plug the target data would be filled in the collection and window outbound plug would be triggered.
    This is a huge topic and  i have just mentioned you basic things.
    Regards,
    Bharathy.

Maybe you are looking for

  • Error in Reading Standard.joboptions

    Adobe PDF-Einstellungen: Fehler beim Lesen der Datei in : C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Adobe\Adobe PDF\Settings\Standard.joboptions System: Windows Server 2003 / Acrobat Standard 9.52 (versions before had the same problem)

  • Why I can't open a sticky note with my PC

    I have created a sticky note with my iPhone, but when I access the file through my PC, I can't open it. Why?

  • Why do phone numbers disappear in Address and IPhone Contacts?

    I've noticed that my wife's phone numbers get cancelled out of the Address Book and IPhone Contacts after a sync. I have only noticed my wife's phone numbers missing. Don't know if others numbers are missing too. Her name and email address and notes

  • Performed SMC reset

    somedays ago i had performed SMC reset on my macbook pro for the heating issue...after the reset my macbook pro stopped heating that much as it used to before the reset...now again my macbook pro has started heating again...

  • Please help me identify this Linux distribution

    Hi! I recently stumbled upon a netbook Linux distribution which where booting very fast but I somehow can't find it again. They had a link to a youtube video on the distros frontpage showing it boot in only 7 seconds (I think). It had a typical netbo