Query to find supervisor_id hierarchy for a person

Hi,
I have a requirement, where i have to find the supervisor id hierarchy (bottom up) for a person. I am using below query to get it.
SELECT LEVEL ,LPAD ( ' ', 7 (LEVEL-1)) || paaf.person_id AS person_id*
FROM   per_all_assignments_f paaf
WHERE sysdate between paaf.effective_start_date and paaf.effective_end_date
START WITH paaf.person_id=2338
CONNECT BY PRIOR paaf.supervisor_id  =  paaf.person_id
Above query is returning the follwing results as i expected.
1 2338
2 2212
3 2105
Here, for 2338 supervisors is------> 2212 supervisor is -----------> 2105
Now, my requirement is, for each person i have to find the direct reporteee list in separate column.
for 2338, need to find direct reportees--------> for 2212, find direct reportees--------> for 2105, find direct reportees in separte column
Note: I am developing a reporting to display the results like above.
Any help is appreciated.
Thanks in advance.

Please use the below query it may help you get the employee & supervisor
SELECT ROWNUM
, pax.supervisor_id
, pax.person_id
, ppx.employee_number
, mgx.employee_number supervisor_staff_number
, REPLACE (ppx.full_name, '''', ' ') full_name
, REPLACE (mgx.full_name, '''', ' ') supervisor_full_name
, pj.NAME job_name
, LEVEL
FROM per_assignments_x pax
, per_people_x ppx
, per_people_x mgx
, per_jobs pj
WHERE ppx.person_id = pax.person_id
AND ppx.current_employee_flag = 'Y'
AND mgx.person_id = pax.supervisor_id
AND pj.job_id = pax.job_id
START WITH ppx.employee_number = :p_emp_num
CONNECT BY NOCYCLE PRIOR mgx.employee_number = ppx.employee_number
--ORDER BY   1 ASC;
Sandeep Yaparla

Similar Messages

  • Sql query to find the balances for a customer account wise.

    Hi,
    Could someone help me with the sql query to find the balances for each customer account wise. This is need to generate the report.
    presently we are using this query, but the output doesnot return the expected result.
    SELECT sum(nvl(ps.acctd_amount_due_remaining,0)) "Balance"
    FROM      ra_cust_trx_line_gl_dist_all gld,
              gl_code_combinations c,
              ar_payment_schedules_all ps,
              RA_CUSTOMER_TRX_ALL rat,
              ra_customers rc
    WHERE      c.CHART_OF_ACCOUNTS_ID = 101
    and gld.code_combination_id = c.code_combination_id
         and rat.CUSTOMER_TRX_ID=gld.CUSTOMER_TRX_ID
         and rat.CUSTOMER_TRX_ID=ps.CUSTOMER_TRX_ID
    and ps.customer_id=rc.customer_id
         and ps.status='OP'
         and ps.gl_date <= :PDATE
         and ps.org_id=:PORGID
         and ps.class in ('GUAR','INV','DM','DEP')
    and c.SEGMENT4=:Account_id
    and ps.customer_id=:Customer_id
    Thanks in advance.
    Kalyan.

    Can someone help us with this.

  • Sql query to find all contacts for an account

    I wonder if someone wrote an sql query to find all contacts for an account number in Oracle customer master. We are on EBS 11.5.10.
    I am also looking for sql query to find all ship to addresses for an account number.
    Thanks.

    Can you also post the query for people who read this post and are also looking for an answer?
    Regards,
    Johan Louwers.

  • Correlated query to find cheapest manufacturer for a product

    Hi,
    I have a SQL Query that returns me:
    - the "product code" i must purchase,
    - the "quantity" to purchase for this product
    - and if it's in "promotion or not".
    Based on this result, i must to look at "manufacturer" table and find the cheapest "price" for each product to purchase and the quantity available at the manufacturer.
    If "quantity to order" (e.g. 20) is higher than "quantity available" (e.g. 12) at "cheapest manufacturer", i must order the missing quantity (8) to the next cheapest manufacturer.
    How can i do that ?
    thx

    ​Hi
    >>correlated query to find cheapest manufacturer for a product
    I have created two table [ProdTable] , [Product Code] to get the cheapeast manufacturer  for a product  which you can refer to .
    [Product Table]
    [Prod Table]
    select [ProdTable].[S_Prod_Code],Min([ProdTable].[Prod_Cost]) as MiniCost
    from [ProdTable] inner join [Product Table] on [ProdTable].[S_Prod_Code]=[Product Table].[Product Code]
    Where [Product Table].[Promotion]<>"YES"
    group by [ProdTable].[S_Prod_Code]
    Using the above query ,you can get the cheapest  cheapeast manufacturer  for a product , which the promotion is not YES
    >>for promotional products, i must firstly check if the cheapest manufacturer has enough prod in stock. If not, i order all the prod in stock the manufacturer has, and i must order to missing ones to the next cheapest manufacturer
    Are you looking for a select query or an update to the table or form design ?Can you separate your business rules with the technolege ?  So more people could understand your issues well to give you more help.
    Thanks for your understanding
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Query to find Org ID for a respnsibility

    Hi,
    I do not have access to Application.
    Can any one suggest me, how to find the org_id for a particular responsibility?
    Thanks,
    Santhosh

    Hi Satyaki_De,
    Thanks for the response.
    I'm talking about Oracle Apps 11i (Application), for which I do not have access as of now. (do not have login ID/pwd)
    How can I find the org_id for the responsibility, 'Inventory organization' (Inv ADM Support, responsibility name)
    I could get the responsibility ID from the table, FND_RESPONSIBILITY_TL
    How do I match this with profile table to get Org_id?
    Thanks,
    Santhosh

  • Need Query to find Pending Quantity for Receipts

    Hi all,
    Can any one please help me in finding the pending quantity for a particular Receipt.
    ex. If a receipt has
    transaction_type Quantity
    Receive 15
    Accept 5
    Deliver 5
    then my accepted quantity should be (Receive-Deliver) = 10
    I have written a query
    SELECT RSH.RECEIPT_NUM RECEIPT_NUM, RSH.CREATION_DATE CREATION_DATE, RT.TRANSACTION_TYPE TRANSACTION_TYPE, NVL(RT.QUANTITY, 0) QUANTITY,rt.destination_type_code destination_type_code,
                   RT.UNIT_OF_MEASURE UNIT_OF_MEASURE, RSL.ITEM_DESCRIPTION ITEM_DESCRIPTION, NVL(RT.PO_UNIT_PRICE, 0) PO_UNIT_PRICE,
                   RT.CURRENCY_CODE CURRENCY_CODE, NVL(RT.CURRENCY_CONVERSION_RATE,0) RATE, RSL.SHIPMENT_LINE_ID SHIPMENT_LINE_ID,
                   NVL(RT.QUANTITY * RT.PO_UNIT_PRICE * RT.CURRENCY_CONVERSION_RATE ,0) VALUE               
         FROM RCV_TRANSACTIONS RT, RCV_SHIPMENT_HEADERS RSH, RCV_SHIPMENT_LINES RSL, PO_VENDORS POV, PO_VENDOR_SITES POVS,
              ORG_ORGANIZATION_DEFINITIONS ORG, HR_LOCATIONS_ALL_TL HRL, PO_LOOKUP_CODES PLC,
              RCV_SUPPLY RS
         WHERE RSH.SHIPMENT_HEADER_ID = RT.SHIPMENT_HEADER_ID
              AND RSH.SHIPMENT_HEADER_ID = RSL.SHIPMENT_HEADER_ID
              AND RSH.RECEIPT_NUM IS NOT NULL
              AND POV.VENDOR_ID (+) = RSH.VENDOR_ID
              AND POVS.VENDOR_SITE_ID (+) = RSH.VENDOR_SITE_ID
              AND HRL.LOCATION_ID (+) = RSH.SHIP_TO_LOCATION_ID AND HRL.LANGUAGE(+) = USERENV('LANG')
              AND ORG.ORGANIZATION_ID (+) = RSH.ORGANIZATION_ID AND RSH.RECEIPT_SOURCE_CODE = PLC.LOOKUP_CODE
              AND PLC.LOOKUP_TYPE = 'SHIPMENT SOURCE TYPE'
              AND RS.RCV_TRANSACTION_ID = RT.TRANSACTION_ID
              AND RT.SHIPMENT_LINE_ID = RSL.SHIPMENT_LINE_ID
              AND RT.TRANSACTION_TYPE IN ('RECEIVE','TRANSFER')
         ORDER BY 1
    I want want the pending quantity...
    Please help

    You can get the quantities in po line locations, then you can find the balance quantity to be received.
    you can get the following from po line locations.
    quantity
    quantity_received
    quantiy_accepted
    quantity_rejected
    quantity_billed
    quantity_cancelled
    --Prasanth                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL Query to find cumulative values for a Financial Year

    Dear users,
    My requirement is to create a SQL query for a table/view where I have day-wise data. I want to find out cumulative values for financial year by giving any date. It should add the values from start of financial year till that date in the financial year.
    I think creating a view of such type will post heavy burden on resources since accuimulation will be done for each day upto that day.
    Thanks

    Dear users,
    My requirement is to create a SQL query for a
    table/view where I have day-wise data. I want to
    find out cumulative values for financial year by
    giving any date. It should add the values from start
    of financial year till that date in the financial
    year.
    I think creating a view of such type will post heavy
    burden on resources since accuimulation will be done
    for each day upto that day.
    ThanksKumar's solution will serve yours purpose but m not agreed
    I think creating a view of such type will post heavy
    burden on resources since accuimulation will be done
    for each day upto that day. Khurram

  • Query to find attachement information for wip operation seq number

    Hi Experts,
    I am working on EBS 11.5.10 and database 9i. I want table link to find attachments for particular operation sequence number.
    Navigation:
    WORK IN PROCESS --> DISCRETE JOBS --> OPERATIONS --> ATTACHMENTS(IN MENU YOU CAN FIND).
    In operations screen, for each operation sequence number, you can have attachement.In attachement, i want to pick the remarks column.
    Table: OPERATIONS -- WIP_OPERATIONS
    ATTACHEMENTS - FND_ATTACHED_DOCS_FORM_VL
    REMARKS - fnd_documents_short_text
    Link between FND_ATTACHED_DOCS_FORM_VL and fnd_documents_short_text is media_id. But i am not able to find the link between wip_operations and fnd_attached_docs_form_vl.
    Could anybody help me how to get attachement data for a particular operation sequence number.
    Thanks in advance.

    The link is
    entity_type = 'WIP_DISCRETE_OPERATIONS' and
    pk1_value =wip_entity_id and
    pk2_value = operation_seq_num and
    pk3_value = organization_idHope this answers your question,
    Sandeep Gandhi

  • Query to find all dependencies for a lookup type

    I have a lookup type and i need to find all the concurrent programs using it.

    Need dependencies for a particular Flexfield structure too.. pls help !!

  • What is sql query to print BOM hierarchy for a give item_number

    Hi,
    anyone is having sql query to print entire bom hiereachy for a given item number.
    Regards,
    ashok

    Try below query
    SELECT /* ORDERED FIRST_ROWS INDEX(MSI MTL_SYSTEM_ITEMS_U1)
    INDEX(BOM BOM_BILL_OF_MATERIALS_U2)
    INDEX(LU10 MFG_LOOKUPS_U1) INDEX(FCL FND_COMMON_LOOKUPS_U1) */
    rowidtochar(bet.rowid) row_id,
    bet.top_bill_sequence_id,
    bet.bill_sequence_id,
    bet.component_sequence_id,
    bet.component_item_id,
    bet.organization_id,
    bet.operation_seq_num,
    bet.plan_level,
    bet.extended_quantity,
    bet.item_num,
    bet.sort_order,
    bet.group_id,
    bet.item_cost,
    nvl(msi.reservable_type, 2) reservable_type,
    bet.extend_cost_flag,
    bet.top_alternate_designator,
    bet.top_item_id,
    bet.effectivity_date,
    bet.disable_date,
    bet.implementation_date,
    decode(bet.implementation_date, null, 2, 1) implemented_flag,
    bet.optional,
    bet.planning_factor,
    bet.component_yield_factor,
    bet.include_in_rollup_flag,
    bet.wip_supply_type wip_supply_type,
    ml2.meaning supply_type,
    bet.supply_subinventory,
    bet.supply_locator_id,
    bet.locator,
    bet.component_remarks,
    bet.change_notice,
    bet.component_quantity,
    bet.operation_lead_time_percent,
    bet.operation_offset,
    bet.mutually_exclusive_options,
    bet.check_atp,
    bet.required_to_ship,
    lu10.meaning so_basis,
    bet.required_for_revenue,
    bet.include_on_ship_docs,
    bet.low_quantity minimum_quantity,
    bet.high_quantity maximum_quantity,
    msi.primary_uom_code unit_of_measure,
    msi.item_type item_type,
    fcl.meaning item_type_description,
    msi.INVENTORY_ITEM_STATUS_CODE item_status,
    msi.description,
    msi.eng_item_flag,
    msi.cum_manufacturing_lead_time,
    msi.cumulative_total_lead_time,
    msi.full_lead_time manufacturing_lead_time,
    bom.assembly_item_id parent_item_id,
    bom.alternate_bom_designator parent_alternate,
    decode(bom.alternate_bom_designator, null, 2, 1) parent_alternate_flag,
    bom.assembly_type eng_bill,
    LPAD(bet.PLAN_LEVEL, LEAST(bet.PLAN_LEVEL, 8), '.') DISPLAY_PLAN_LEVEL,
    TO_CHAR(BET.EFFECTIVITY_DATE, 'HH24:MI') EFFECTIVITY_TIME,
    TO_CHAR(BET.DISABLE_DATE, 'HH24:MI') DISABLE_TIME,
    BET.EXTENDED_QUANTITY EXTENDED_QUANTITY6,          
    DECODE(BET.EXTEND_COST_FLAG, 1, BET.ITEM_COST * BET.EXTENDED_QUANTITY, 2, 0, NULL) EXTENDED_COST,
    BET.OPERATION_SEQ_NUM OPERATION_SEQ_NUM7,          
    MSI.BOM_ITEM_TYPE bom_item_type,
    MSI.REPLENISH_TO_ORDER_FLAG,
    MSI.PICK_COMPONENTS_FLAG,
    MSI.ATP_COMPONENTS_FLAG,
    MSI.ATP_FLAG,
    MSI.SHIPPABLE_ITEM_FLAG,
    MSI.MRP_PLANNING_CODE,
    MSI.SO_TRANSACTIONS_FLAG,
    MSI.CUSTOMER_ORDER_ENABLED_FLAG,
    MSI.INVOICE_ENABLED_FLAG,
    MSI.INVENTORY_ASSET_FLAG,
    MSI.SEGMENT1,
    MSI.SEGMENT1,
    BET.CURRENT_REVISION,
    MSI.GLOBAL_ATTRIBUTE6 ITEM_SPECIFICATION,
    BIC.ATTRIBUTE2 ITEM_SVC,
    BIC.ATTRIBUTE3 ITEM_SF,
    BIC.ATTRIBUTE10 ITEM_DPC,
    BIC.ATTRIBUTE12 RECV_DEPT_CD,
    BD.DEPARTMENT_CODE ROU_RECV_DEPARTMENT,
         msi.description ENG_DESC,
         msi.global_attribute6 ENG_SPEC,
         msi.primary_uom_code ENG_UOM,
         bet.component_quantity ENG_QTY,
         msi.item_type ENG_UIT,
         ml2.meaning ENG_SUPPLY_TYPE,
         bet.extend_cost_flag ENG_COST_FLAG,
    BIC.INCLUDE_IN_COST_ROLLUP INCLUDE_IN_COST_ROLLUP,
    msi.planning_make_buy_code,
    bet.Attribute13,
    bet.Attribute14,
    MSI.GLOBAL_ATTRIBUTE9,
    msi.segment9 AI_TYPE
    FROM MFG_LOOKUPS ML2,
    MFG_LOOKUPS LU10,
    FND_COMMON_LOOKUPS FCL,
    BOM_BILL_OF_MATERIALS BOM,
    MTL_SYSTEM_ITEMS MSI,
    BOM_SMALL_EXPL_TEMP BET,
    BOM_INVENTORY_COMPONENTS BIC,     
    BOM_OPERATIONAL_ROUTINGS BOR,
    BOM_OPERATION_SEQUENCES BOS,
    BOM_DEPARTMENTS BD               
    WHERE bet.component_item_id = msi.inventory_item_id
    and bet.bill_sequence_id = bom.bill_sequence_id
    and bet.organization_id = msi.organization_id
    and lu10.lookup_code (+) = bet.so_basis
    and bic.component_sequence_id(+) = bet.component_sequence_id     
    and lu10.lookup_type (+) = 'BOM_SO_BASIS'
    and fcl.lookup_code (+) = msi.item_type
    and fcl.lookup_type (+) = 'ITEM_TYPE'
    and fcl.application_id (+) = 401
    and ml2.lookup_code (+) = bet.wip_supply_type
    and ml2.lookup_type (+) = 'WIP_SUPPLY'
    and bet.assembly_item_id = bor.assembly_item_id(+)     
    and bet.organization_id = bor.organization_id(+)
    and bor.alternate_routing_designator(+) is null
    and bor.routing_sequence_id = bos.routing_sequence_id(+)
    and 10 = bos.operation_seq_num(+)               
    and bos.effectivity_date(+) <= sysdate
    and sysdate < nvl(bos.disable_date(+),sysdate + 1)
    and bos.department_id = bd.department_id(+)          
    /

  • How to find a hierarchy of all Itmes Pages inside a Page

    Hi,
    I am using Oracle Portal 10.1.2. Need some information:
    I have a page with Items or it can have both items, sub-pages and further each subpage can have items and/or sub-pages. How can I find all the objects in a hierarchical order. How can I construct my SQL to query the back-end tables that I can query to build a hierarchy for the whatever Page's pageid I provide.
    If given a Page ID need to return all the items, sub-pages and so forth. I am trying to build a Tree structure Menu.
    I have one Top page with tabs and in each tab I am adding one Portlet i.e. a page that is published as Portlet. Now this page which is published as a portlet can only have Items added or can have n number of sub-pages underneath which in-turn can have items and/or sub-pages and so forth, just like a Folder Structure in Windows. As soon as the user clicks a tab want to show all the items/pages in a tree like format.
    Any idea on how can I proceed any help is really appreciated.
    Thanks

    Hi,
    I am using Oracle Portal 10.1.2. Need some information:
    I have a page with Items or it can have both items, sub-pages and further each subpage can have items and/or sub-pages. How can I find all the objects in a hierarchical order. How can I construct my SQL to query the back-end tables that I can query to build a hierarchy for the whatever Page's pageid I provide.
    If given a Page ID need to return all the items, sub-pages and so forth. I am trying to build a Tree structure Menu.
    I have one Top page with tabs and in each tab I am adding one Portlet i.e. a page that is published as Portlet. Now this page which is published as a portlet can only have Items added or can have n number of sub-pages underneath which in-turn can have items and/or sub-pages and so forth, just like a Folder Structure in Windows. As soon as the user clicks a tab want to show all the items/pages in a tree like format.
    Any idea on how can I proceed any help is really appreciated.
    Thanks

  • Query for Supervisor Hierarchy for top most manager

    Hi,
    I have requirement where I have to start from one employee and move up to top-most supervisor of that employee:
    For example starting from Employee ABC and moving to supervisor3 through supervisor hierarachy.
    Employee ABC
    Supervisor1*
    Supervisor2*
    Supervisor3*
    Can anyone help me in constructing such query.
    Regards,
    Salman Ahmad

    The linked query is to find a loop in the Supervisor hierarchy top down.
    The SQL here will display the current supervisor hierarchy for a specified subordinate bottom to top.
    select level, rpad(' ',level*2)||paa.person_id, pap.first_name, pap.last_name
    from per_all_assignments_f paa
    join per_all_people_f pap
    on paa.person_id = pap.person_id
    and sysdate between pap.effective_start_date and pap.effective_end_date
    where sysdate between paa.effective_start_date and paa.effective_end_date
    start with paa.person_id = :PersonID
    connect by paa.person_id = prior paa.supervisor_id
    and sysdate between prior paa.effective_start_date and prior paa.effective_end_date;

  • Where can I find the user key precedence hierarchy for each record type?

    Example: I want to update contact records through the CRMOD web service API.
    So I'm looking at the "Oracle Web Services On Demand Guide, Version 6.0 (released August 2010)", page 316, and it lists 3 user keys for Contact.wsdl v2.0 in the following order:
    1. FirstName and LastName
    2. Id
    3. ExternalSystemId
    From what I can see, this order does not seem to reflect the precedence hierarchy of these 3 user keys.
    I've send in a test update where I supplied a FN, LN, and EUID, ... and the contact that matched the EUID got updated.
    (I'm glad it did, because EUID really needs to take precedence over FN+LN, otherwise you could never change a contact's last name without knowing the contact's Row Id.)
    Does anyone know where I can find the precedence hierarchy for each record type's user keys (other than doing the obvious and time consuming "try+error")?

    Hi,
    we experienced similar problems with the account object and asked the oracle support about this. This was their answer:
    "[...] thank you for contacting CRM On Demand Customer Care. Regarding your question, please note the below: when perfoming a query, the user key fields are looked for in this order: - Row id - External System Id - AccountName and Location. Basically, the search will be performed by AccountName and Location only when the other fields are missing. This is an expected behavior because, the Row Id is the strongest filter as it is always unique. The external system Id comes second, as it is supposed to be unique in another system."
    So, I guess the order is always
    1) Row Id
    2) External System Id
    3) specific field combinations...
    kind regards
    Kai
    Edited by: Kai Hartmann on 28.04.2011 07:10

  • Can anyone give me query to find  in SSHR 1) No. of Changes(Personal Info Update) Requested 2) No. of Processed Requests

    Dear Experts,
    Can anyone give me query to find  in SSHR 1) No. of Changes(Personal Info Update) Requested 2) No. of Processed Requests
    1) No. of Changes(Personal Info Update) Requested
    select COUNT(*)
      from hr_api_transactions
    where process_name like 'HR_PERSONAL_INFO_JSP_PRC'
       and creation_date between '01-JAN-2014' AND '31-DEC-2014';
    How do know whether they were processed successfully
    where to see the meaning of Status column of HR_API_TRANSACTION?
    Thanks
    Rahul

    Hi Rahul,
    For transaction status check the below query -
    select * from fnd_lookup_values
    where lookup_type like 'PQH_SS_TRANSACTION_STATUS'
    and language = 'US';
    Cheers,
    Vignesh

  • Query to find out the time used by an user for an application

    Hello All,
    I want to know the query to find out the whole time used by the user for an application. Please view the below data
    Employee:
    SNO EMP_ID EMP_NAME EMP_DATE LOGIN_TIME LOGOUT_TIME
    1 10 Visu 21-Nov-2010 06:30:00 07:30:00
    2 10 Visu 21-Nov-2010 06:40:00 07:20:00
    3 10 Visu 21-Nov-2010 06:50:00 07:50:00
    4 10 Visu 21-Nov-2010 07:30:00 08:30:00
    5 10 Visu 21-Nov-2010 09:30:00 10:30:00
    By checking the above data we can say that the total time Visu used the application is
    8.30 - 6.30 (From 1,2,3,4 records) = 2hrs
    10.30 - 9.30 (Based on 5th rec) = 1hr
    So the total time Visu used the application would be 3 hrs = 180 mins.
    Could you please help me in getting the result from that data using a query?

    odie_63 wrote:
    I think it may be solved with analytics too.
    with t1 as (
                select 1 sno,10 emp_id,'Visu' emp_name,'21-Nov-2010' emp_date,'06:30:00' login_time,'07:30:00' logout_time from dual union all
                select 2,10,'Visu','21-Nov-2010','06:40:00','07:20:00' from dual union all
                select 3,10,'Visu','21-Nov-2010','06:50:00','07:50:00' from dual union all
                select 4,10,'Visu','21-Nov-2010','07:30:00','08:30:00' from dual union all
                select 5,10,'Visu','21-Nov-2010','09:30:00','10:30:00' from dual
         t2 as (
                select  emp_id,
                        emp_name,
                        emp_date,
                        to_date(emp_date || login_time,'DD-MON-YYYYHH24:MI:SS') login_time,
                        to_date(emp_date || logout_time,'DD-MON-YYYYHH24:MI:SS') logout_time
                  from  t1
         t3 as (
                select  t2.*,
                        case
                          when login_time < max(logout_time) over(
                                                                  partition by emp_id,emp_date
                                                                  order by login_time
                                                                  rows between unbounded preceding
                                                                           and 1 preceding
                            then 0
                          else 1
                        end start_of_group
                  from  t2
         t4 as (
                select  t3.*,
                        sum(start_of_group) over(partition by emp_id,emp_date order by login_time) grp
                  from  t3
         t5 as (
                select  emp_id,
                        emp_date,
                        min(login_time) login_time,
                        max(logout_time) logout_time
                  from  t4
                  group by emp_id,
                           emp_date,
                           grp
    select  emp_id,
            numtodsinterval(sum(logout_time - login_time),'day') time_spent
      from  t5
      group by emp_id
      order by emp_id
        EMP_ID TIME_SPENT
            10 +000000000 03:00:00.000000000
    SQL> SY.

Maybe you are looking for

  • Is it possible to prevent the admin hack on a mack

    Hi any of youse know that there is an hack for macs where users can easily delete a setup file on the mac and reboot it so they can  setup another mac admin account Im wondering how to prevent this from occuring

  • Music player & radio disable after phone update

    When i opened music player or radio, mobile screen was full white on display, music player or radio working but can't see anything its happened after update phone, mobile is nokia 2700 classic

  • IPhone 4 keyboard stop working

    Can anyone help me??!! I have the iPhone 4 and some of the buttons on my keyboard isnt working. What do I need to do ??

  • F110 -Too many payment mediums created for this payment group

    Hello Gurus, Am getting below error after executing payment run F110. BFIBL02160               Too many payment mediums created for this payment group BFIBL02616               End of log for payment run 20140409 / DPA04 , PE1 / 500 We are not able to

  • Business area doubt

    Dear experts, My doubt is when we execute the trial balance in f.01 let me tell some thing regarding that we have created business area clearing account my client doubt is why business area clearing account is appearing in trial balance is any way wh