Need help tuning slow running query

Need help tuning below two Oracle queries:
Query #1:
======================
SELECT "WORK_ORDER_FACT_ALL_YESTERDAY"."WORK_ORDER_HISTORY_ID",
"WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_NUMBER",
"ACCOUNT_DIM"."ACCOUNT_NUMBER", "ACCOUNT_DIM"."ACCOUNT_WS_DISC_DATE"
FROM "CDWD"."WORK_ORDER_FACT_ALL_YESTERDAY" "WORK_ORDER_FACT_ALL_YESTERDAY",
"CDWD"."ACCOUNT_DIM" "ACCOUNT_DIM"
WHERE (SUBSTR ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_FIRST_NAME", 1, 1) =
SUBSTR ("ACCOUNT_DIM"."ACCOUNT_FIRST_NAME", 1, 1)
AND (SUBSTR ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_LAST_NAME", 1, 4) =
SUBSTR ("ACCOUNT_DIM"."ACCOUNT_LAST_NAME", 1, 4)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_DL_NUMBER" =
"ACCOUNT_DIM"."ACCOUNT_DL_NUMBER"
AND "WORK_ORDER_FACT_ALL_YESTERDAY"."WO_TYPE_CODE" IN ('25', '27')
AND ("ACCOUNT_DIM"."REVENUE_TYPE_ID" = 1)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."TRANSFER_COUNT" = 0)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."WINBACK_ADD_COUNT" = 0)
AND ("ACCOUNT_DIM"."ACCOUNT_WS_ENTRY_DATE" <
(TO_DATE ('2006.05.02', 'yyyy.mm.dd') - 11
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."IS_DERIVED" = 0)
AND ("ACCOUNT_DIM"."EXPIRATION_DATE" IS NULL)
AND ("WORK_ORDER_FACT_ALL_YESTERDAY"."ACT_ACCOUNT_TYPE_CD" <> '50');
Query #2
==================
UPDATE work_order_fact_all_yesterday g
SET returns_count = 1
WHERE EXISTS (SELECT 1
FROM (SELECT a.phone_dim_key AS transactional_phone_dim_key,
b.mdn_number AS transactional_mdn_number,
b.account_number AS transactional_account_number
FROM work_order_fact_all_yesterday a INNER JOIN phone_dim b ON a.phone_dim_key = b.phone_dim_key
WHERE a.gross_deactivations_count = 1) e
INNER JOIN (SELECT c.phone_dim_key AS historical_phone_dim_key,
d.mdn_number AS historical_mdn_number,
d.account_number AS historical_account_number
FROM (SELECT phone_dim_key
FROM work_order_activity_fact
WHERE gross_adds_count = 1
AND report_date >= :b1 - 66
AND NVL (is_derived, 0 ) = 0
UNION
SELECT phone_dim_key
FROM work_order_fact_all_yesterday
WHERE gross_adds_count = 1
AND is_derived = 0) c
INNER JOIN phone_dim d ON c.phone_dim_key = d.phone_dim_key ) f
ON e.transactional_mdn_number = f.historical_mdn_number
AND e.transactional_account_number = f.historical_account_number
WHERE e.transactional_phone_dim_key = g.phone_dim_key)
AND g.gross_deactivations_count = 1
AND g.account_revenue_type_id = 1;
I ran the DBMS_SQLTUNE on it for 10g and did not get any advice. How can I tune the above queries? Thanks!

Tune the SQL? Looking at the join criteria of SUBSTR("WORK_ORDER_FACT_ALL_YESTERDAY"."ACCOUNT_FIRST_NAME", 1, 1) = SUBSTR ("ACCOUNT_DIM"."ACCOUNT_FIRST_NAME", 1, 1) and other substrings, it seems to me that you have basic flaws in your relation design.
Column must be atomic values. Having to extract a sub-set value from a column to create the intelligence needed to join to another table - that is just plain wrong in relation design. Never mind the performance impact and overheads it causes in the database.

Similar Messages

  • Help with slow running query

    Hi,
    I am having some performance problems on OBIEE dashboards so I am trying to figure out what is going wrong by looking at the query being generated.
    I have spent time simplifying the query down to a very basic select statement, and trying to see why it still takes about ~5 seconds to run. See the following explain plan:
    SQL> explain plan for
      2  select count(distinct CASES_FACT.CASE_KEY) as CASE_COUNT
      3    from
      4         COMPSTAT_CASES_DIM CASES_DIM /* Dim - COMPSTAT_CASES_DIM */ ,
      5         COMPSTAT_CASES_FACT CASES_FACT /* Fact - COMPSTAT_CASES_FACT */
      6   where (    CASES_FACT.CASE_KEY = CASES_DIM.CASE_KEY  );
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 372393383
    | Id  | Operation              | Name            | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |                 |     1 |    12 |       |  2741   (3)| 00:00:33 |
    |   1 |  SORT GROUP BY         |                 |     1 |    12 |       |            |          |
    |*  2 |   HASH JOIN            |                 |   925K|    10M|    15M|  2741   (3)| 00:00:33 |
    |   3 |    INDEX FAST FULL SCAN| CASE_KEY        |   909K|  5327K|       |   674   (3)| 00:00:09 |
    |   4 |    INDEX FAST FULL SCAN| CASES_FACT_IDX4 |   925K|  5421K|       |   466   (4)| 00:00:06 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - access("CASES_FACT"."CASE_KEY"="CASES_DIM"."CASE_KEY")
    16 rows selected.We have the indexes on the columns being joined on, and it appears to use a fast full scan on that index, but still the query takes about 5 seconds to run, just for this very simple query. When I add the rest of the joins and conditions that are in the actual OBIEE query, it's more like a 15 second query. It needs to be much faster.
    Any ideas? Btw I am not a DBA or tuning expert, simply an OBIEE developer that was tasked with fixing this performance.
    Thanks.

    both tables have ~1M rows so no much choice. Assuming the dim table has unique index, nest loop join is usually faster. try the two sql below to see any improvement
    select /*+ use_nl(a b) */ count(distinct a.CASE_KEY)
    from COMPSTAT_CASES_FACT a,
    inner join COMPSTAT_CASES_DIM b on b.CASE_KEY = a.CASE_KEY
    select /*+ use_nl(a b) */ count(*)
    from (select distinct CASE_KEY from COMPSTAT_CASES_FACT) a
    inner join COMPSTAT_CASES_DIM b on b.CASE_KEY = a.CASE_KEY
    ;

  • Need help tuning join in slow query

    Hi all,
    I have the following issue to tune the below join condition in my query below:
    SELECT PO.COMPANY,
    PO.UPDATE_DATE,
    PO.EXTENDED_AMT,
    PO.LOCATION,
    ICLOCATION.R_NAME AS LOCATION_DESC,
    PO.VENDOR,
    AP.VENDOR_VNAME,
    MAJOR.DESCRIPTION AS MAJOR_DESC,
    MINOR.DESCRIPTION AS MINOR_DESC,
    CASE po.purch_majcl
    WHEN ' '
    THEN 'NONE'
    ELSE po.purch_majcl
    END AS PURCH_MAJ,
    CASE po.purch_min
    WHEN ' '
    THEN 'NONE'
    ELSE po.purch_min
    END AS PURCH_MIN,
    CASE po.manuf_code
    WHEN ' '
    THEN 'NO MFG'
    ELSE po.manuf_code
    END AS MANUF_CODE,
    CASE po.manuf_nbr
    WHEN ' '
    THEN 'NONE'
    ELSE po.manuf_nbr
    END AS MANUF_NBR,
    CASE po.manuf_division
    WHEN ' '
    THEN 'NONE'
    ELSE po.manuf_division
    END AS MANUF_DIV,
    CASE po.agreement_ref
    WHEN ' '
    THEN 'NONE'
    ELSE PO.AGREEMENT_REF
    END AS AGRMT_REF,
    /* ITEMLOC IS REQUIRED TO GET TO ICCACATEGORY */
    CASE po.item_type
    WHEN 'I'
    THEN ICCATEGORY.INV_ACCT_UNIT
    ELSE MMDIST.ACCT_UNIT
    END AS ACCT_UNIT,
    CASE po.item_type
    WHEN 'I'
    THEN ICCATEGORY.GL_CATEGORY
    ELSE to_char(MMDIST.ACCOUNT)
    END AS ACCOUNT,
    /* ITEMLOC IS REQUIRED TO GET TO ICCACATEGORY */
    PO.ITEM_TYPE,
    PO.ITEM,
    PO.DESCRIPTION AS ITEM_DESC,
    PO.ENT_REC_UOM,
    PO.ENT_RUOM_MULT,
    PO.ENT_REC_QTY,
    PO.ORIG_UNIT_CST,
    PO.MATCH_UNIT_CST,
    PO.PO_NUMBER,
    PO.PO_LINE_NBR,
    PO.QTY_TO_PROC,
    PURCHORDER.PO_DATE,
    PURCHORDER.BUYER_CODE,
    BUYER.R_NAME AS BUYER_NAME
    FROM LAW.PURCHORDER, LAWS81.BUYER,
    LAW.ICLOCATION, LAW.APVENMAST,
    LAW.PO LEFT JOIN LAW.MMDIST
    ON (PO.COMPANY = MMDIST.COMPANY
    AND PO.LOCATION = MMDIST.LOCATION
    AND PO.PO_NUMBER = MMDIST.DOC_NUMBER
    AND PO.PO_RELEASE = MMDIST.DOC_NBR_NUM
    AND PO.PO_CODE = MMDIST.PO_CODE
    AND PO.PO_LINE_NBR = MMDIST.LINE_NBR
    AND MMDIST.SYSTEM_CD = 'PO'
    AND MMDIST.DOC_TYPE = 'PT'
    AND MMDIST.COMPONENT_SEQ = 0
    AND MMDIST.AOC_CODE = ' ')
    /* 1st JOIN TO ITEMLOC */
    LEFT JOIN LAW.ITEMLOC
    ON PO.COMPANY = ITEMLOC.COMPANY
    AND PO.LOCATION = ITEMLOC.LOCATION
    AND PO.ITEM = ITEMLOC.ITEM,
    /* 2nd JOIN from ITEMLOC to ICCATEGORY */
    /* It should use the ITEMLOC join from above */
    /* creating cartesian product with itemloc */
    LAW.ITEMLOC LEFT JOIN LAW.ICCATEGORY
    ON ITEMLOC.COMPANY = ICCATEGORY.COMPANY
    AND ITEMLOC.LOCATION = ICCATEGORY.LOCATION
    AND ITEMLOC.GL_CATEGORY = ICCATEGORY.GL_CATEGORY,
    /* need to get to ICCATEGORY table using 2nd JOIN condition above */
    LAW.PO LEFT JOIN LAW.MAJOR
    ON PO.PURCH_MAJ = MAJOR.MAJOR_CLASS
    AND MAJOR.CLASS_TYPE = 'P'
    LEFT JOIN LAW.MINOR
    ON PO.PURCH_MAJCL = MINOR.MAJOR_CLASS
    AND PO.PURCH_MINCL = MINOR.MINOR_CLASS
    AND MINOR.CLASS_TYPE = 'P'
    WHERE PO.COMPANY = PO.COMPANY
    AND PO.PO_NUMBER = PO.PO_NUMBER
    AND PO.PO_RELEASE = PO.PO_RELEASE
    AND PO.PO_CODE = PO.PO_CODE
    AND PO.PO_LINE_NBR = PO.LINE_NBR
    AND PO.COMPANY = ICLOCATION.COMPANY
    AND PO.LOCATION = ICLOCATION.LOCATION
    AND PO.VENDOR = APVENMAST.VENDOR
    AND PO.COMPANY = PURCHORDER.COMPANY
    AND PO.PO_CODE = PURCHORDER.PO_CODE
    AND PO.PO_NUMBER = PURCHORDER.PO_NUMBER
    AND PO.PO_RELEASE = PURCHORDER.PO_RELEASE
    AND PURCHORDER.BUYER_CODE = BUYER.BUYER_CODE
    AND PO.R_STATUS = 1
    AND PO.ENT_REC_QTY > 0
    This query runs very slow and we cannot change the code to add or modify indexes. We need to join the 2nd table to the third table with optimized performance. How can I tune this slow running query with the best join conditions?
    Thanks

    I want to join the OS_LOCN_CURR_STK table with the
    OT_PO_ITEM table , such that all items in
    OS_LOCN_CURR_STK are displayed.
    If you want all items in OS_LOCN_CURR_STK to be returned, use an OUTER JOIN on the columns joining the 2 tables.

  • Need help in refining the query

    Hello Experts,
    Need your help in refining the query further more.
    table structure 
    Mskey  Col A Col B
    1   empno [20141127-20151128]1234
    1   empno [20151201-99991231]232544
    1   salutation [20141127-99991231]Mrs
    1   salutation [20151127-99991231]Mr
    2   empno [20141127-20151128]1234
    2   empno [20151201-99991231]232544
    2   salutation [20141127-99991231]Mrs
    2   salutation [20151127-99991231]Mr
    My requirement is to find the list of overlapping records based on the dates
    user details may be varying from time to time as new data would be pushed through HR systems to identity store via an interface.
    The job is getting failed whenever there is any overlapping with dates. So we proactively decided to schedule a job in this regards which runs weekly and would let us know for which and all the users there is overlapping dates are there, so that we can send the list to HR team for pushing new data.
    Overlapping Issue Example:
    The users employee id for an year it is 1234 and later he moved to another department and his employee id got changed and it became 2345 remaining all details are same. So the HR systems send the data for this user as empno - [20141127-20151128]1234 and empno - [20151201-99991231]232544
    it means from 20141127 to 20151128 his employee no is 1234 and from 20151201 to 99991231 his employee would be 2345.
    This is a correct case and the tool would accept this data.
    the below cases are invald
    Case 1: 1 salutation [20141127-99991231]Mrs 1 salutation [20151127-99991231]Mr
    Case 2: 2 salutation [20141127-99991231]Mrs 2 salutation [20141127-99991231]Mr
    So we wanted to find these overlapping records from tables.
    My Query:
    I am able to successfully write query for the case 2 type but unable to write for case1.
    select id,colA
    count(left(ColB,CHARINDEX(']',ColB))) as 'Count'
    from tblA with (nolock)
    where id in (Select distinct id from tblb with (nolock))
    group by id, cola,left(ColB,CHARINDEX(']',ColB))
    having count(left(ColB,CHARINDEX(']',ColB)))>1

    Finally got the required answer with the below query
    WITH Cte AS
    SELECT ID,ColA,ColB,ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS RN,
    CAST(SUBSTRING(ColB,2,CHARINDEX('-',ColB)-2) AS DATE) AS StartDT,
    CAST(SUBSTRING(ColB,CHARINDEX('-',ColB)+1,8) AS DATE)  AS EndDT  FROM TblA
    SELECT c1.ID, c1.ColA,c1.ColB
    FROM Cte c1 JOIN Cte c2
    ON c1.RN != c2.RN
    AND c1.ID=c2.ID
    AND c1.ColA=c2.ColA
    AND (c1.StartDT BETWEEN c2.StartDT AND c2.EndDT OR c2.StartDT BETWEEN c1.StartDT AND c1.EndDT )

  • Need help with writing a query with dynamic FROM clause

    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'Simply sticking the later query in the first query does not work.
    Any pointers will be appreciated.
    Thanks
    rogers42

    Hi,
    rogers42 wrote:
    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'
    Remember that anything inside quotes is case-sensitive. Is the owner really "Schema_Name" with a capital S and a capital N, and 8 lower-case letters?
    Simply sticking the later query in the first query does not work.Right; the table name must be given when you compile the query. It's not an expression that you can generate in the query itself.
    Any pointers will be appreciated.In SQL*Plus, you can do something like the query bleow.
    Say you want to count the rows in scott.emp, but you're not certain that the name is emp; it could be emp_2011 or emp_august, or anything else that starts with e. (And the name could change every day, so you can't just look it up now and hard-code it in a query that you want to run in the future.)
    Typically, how dynamic SQL works is that some code (such as a preliminary query) gets some of the information you need to write the query first, and you use that information in a SQL statement that is compiled and run after that. For example:
    -- Preliminary Query:
    COLUMN     my_table_name_col     NEW_VALUE my_table_name
    SELECT     table_name     AS my_table_name_col
    FROM     all_tables
    WHERE     owner          = 'SCOTT'
    AND     table_name     LIKE 'E%';
    -- Main Query:
    SELECT     COUNT (*)     AS cnt
    FROM     scott.&my_table_name
    ;This assumes that the preliminary query will find exactly one row; that is, it assumes that SCOTT has exactly one table whose name starts with E. Could you have 0 tables in the schema, or more than 1? If so, what results would you want? Give a concrete example, preferably suing commonly available tables (like those in the SCOTT schema) so that the poepl who want to help you can re-create the problem and test their ideas.
    Edited by: Frank Kulash on Aug 11, 2011 2:30 PM

  • Problem trying to diagnose slow running query

    Hi, Group.
    I have two versions of the same query. sql1 contains an inner select, sql2 contains the hard-coded values that the inner select returns. Other than that the queries look the exact same.
    sql1 takes over 8 minutes to complete.
    sql2 takes about 250ms to complete.
    I tried running explain plan on both queries and sql1 appears to be the better query based on the plan_table cost columns. I even ran a query that shows the plan hash value for the currently running query. Both times, the slower query appears to be quicker.
    So my problem is that all the diagnosis indicates that sql1 is faster than sql2 but in reality, sql2 is waaaaaaaaaaaaaaaaaaaaay faster than sql1. Does anyone have any other suggestions for tools that I can use that show why the supposedly fast query is actually the slower query?
    Thanks, Max
    EDIT: here is an example of sql1 and sql2 to help you visualize the problem.
    SELECT <column list>
    FROM <table list>
    WHERE column IN (SELECT column FROM table)
    AND <some more predicates>
    SELECT <column list>
    FROM <table list>
    WHERE column IN (value1, value2, value3)
    AND <some more predicates>

    The slow query is listed first.
    PLAN_TABLE_OUTPUT
    Plan hash value: 2494202055
    | Id  | Operation                          | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                                |     1 |   869 |    10  (20)| 00:00:01 |
    |   1 |  SORT UNIQUE                       |                                |     1 |   869 |     9  (12)| 00:00:01 |
    |   2 |   NESTED LOOPS OUTER               |                                |     1 |   869 |     8   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS                    |                                |     1 |   749 |     7   (0)| 00:00:01 |
    |   4 |     NESTED LOOPS                   |                                |     1 |   725 |     6   (0)| 00:00:01 |
    |   5 |      NESTED LOOPS                  |                                |     1 |   701 |     6   (0)| 00:00:01 |
    |   6 |       NESTED LOOPS                 |                                |     1 |   685 |     3   (0)| 00:00:01 |
    |   7 |        NESTED LOOPS                |                                |     1 |   645 |     1   (0)| 00:00:01 |
    |*  8 |         TABLE ACCESS BY INDEX ROWID| MASTERDATA_ATTRIBUTE           |     1 |   387 |     1   (0)| 00:00:01 |
    |*  9 |          INDEX RANGE SCAN          | I_MSTRRBT_M_VALUE              |     1 |       |     1   (0)| 00:00:01 |
    |* 10 |         TABLE ACCESS BY INDEX ROWID| MASTERDATA_ELEMENT             |     1 |   258 |     0   (0)| 00:00:01 |
    |* 11 |          INDEX UNIQUE SCAN         | I_MSTRMNT_M_VOCABULARYELEMENTI |     1 |       |     0   (0)| 00:00:01 |
    |  12 |        TABLE ACCESS BY INDEX ROWID | EPCIS_EVENT                    |     1 |    40 |     2   (0)| 00:00:01 |
    |* 13 |         INDEX RANGE SCAN           | I_PCS_VNT_M_BUSINESSLOCATIONUR | 65659 |       |     2   (0)| 00:00:01 |
    |* 14 |       TABLE ACCESS BY INDEX ROWID  | EPCIS_EVENT_EPC                |     2 |    32 |     3   (0)| 00:00:01
    |* 15 |        INDEX RANGE SCAN            | I_PCS__PC_EVENT_ID             |     2 |       |     2   (0)| 00:00:01 |
    |  16 |      TABLE ACCESS BY INDEX ROWID   | EPCIS_EVENT_EPC                |     2 |    48 |     0   (0)| 00:00:01
    |* 17 |       INDEX RANGE SCAN             | I_PCS__PC_EVENT_ID             |     2 |       |     2   (0)| 00:00:01 |
    |* 18 |     TABLE ACCESS BY INDEX ROWID    | EPC                            |     1 |    24 |     1   (0)| 00:00:01 |
    |* 19 |      INDEX UNIQUE SCAN             | SYS_C0012080                   |     1 |       |     0   (0)| 00:00:01 |
    |  20 |    TABLE ACCESS BY INDEX ROWID     | EPC                            |     1 |   120 |     1   (0)| 00:00:01 |
    |* 21 |     INDEX UNIQUE SCAN              | SYS_C0012080                   |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       8 - filter("T4"."MD_ATTRIBUTE_META_ID"='urn:epcglobal:epcis:mda:coun
                                try')
       9 - access("T4"."VALUE"='USA')
      10 - filter("T3"."MD_ELEMENT_META_ID"='urn:epcglobal:epcis:vtype:BusinessLo
                              cation')
      11 - access("T3"."MD_ELEMENT_ID"="T4"."PARENT_MD_ELEMENT_ID")
      13 - access("T0"."BUSINESS_LOCATION_URI"="T3"."MD_ELEMENT_ID")
      14 - filter(("T0"."EVENT_TYPE"='AGGREGATION' OR "T0"."EVENT_TYPE"='TRANSACTION') AND
                  "T1"."PARENT_EVENT_EPC_ID" IS NOT NULL OR "T0"."EVENT_TYPE"='OBJECT')
      15 - access("T0"."EVENT_ID"="T1"."EVENT_ID")
      17 - access("T0"."EVENT_ID"="T5"."EVENT_ID")
      18 - filter("T2"."COMPANY_PREFIX"='1' AND "T2"."REFERENCE"='1' AND "T2"."SCHEME"='gid')
      19 - access("T1"."EPC_ID"="T2"."EPC_ID")
      21 - access("T5"."EPC_ID"="T6"."EPC_ID"(+))
    46 rows selected.
    Explained.
    PLAN_TABLE_OUTPUT
    Plan hash value: 3062511058
    | Id  | Operation                        | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                 |                       |     7 |  1568 |    38   (6)| 00:00:01 |
    |   1 |  SORT UNIQUE                     |                       |     7 |  1568 |    37   (3)| 00:00:01 |
    |   2 |   NESTED LOOPS OUTER             |                       |     7 |  1568 |    36   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS                  |                       |     7 |   728 |    29   (0)| 00:00:01 |
    |   4 |     NESTED LOOPS                 |                       |     4 |   320 |    17   (0)| 00:00:01 |
    |   5 |      NESTED LOOPS                |                       |     4 |   160 |    13   (0)| 00:00:01 |
    |*  6 |       TABLE ACCESS BY INDEX ROWID| EPC                   |     1 |    24 |    10   (0)| 00:00:01 |
    |*  7 |        INDEX RANGE SCAN          | I_EPC_M_COMPANYPREFIX |   220 |       |     3   (0)| 00:00:01 |
    |   8 |       TABLE ACCESS BY INDEX ROWID| EPCIS_EVENT_EPC       |     6 |    96 |     3   (0)| 00:00:01
    |*  9 |        INDEX RANGE SCAN          | I_PCS__PC_EPC_ID      |     7 |       |     2   (0)| 00:00:01 |
    |* 10 |      TABLE ACCESS BY INDEX ROWID | EPCIS_EVENT           |     1 |    40 |     1   (0)| 00:00:01 |
    |* 11 |       INDEX UNIQUE SCAN          | SYS_C0012082          |     1 |       |     0   (0)| 00:00:01 |
    |  12 |     TABLE ACCESS BY INDEX ROWID  | EPCIS_EVENT_EPC       |     2 |    48 |     3   (0)| 00:00:01
    |* 13 |      INDEX RANGE SCAN            | I_PCS__PC_EVENT_ID    |     2 |       |     2   (0)| 00:00:01 |
    |  14 |    TABLE ACCESS BY INDEX ROWID   | EPC                   |     1 |   120 |     1   (0)| 00:00:01 |
    |* 15 |     INDEX UNIQUE SCAN            | SYS_C0012080          |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       6 - filter("T2"."REFERENCE"='1' AND "T2"."SCHEME"='gid')
       7 - access("T2"."COMPANY_PREFIX"='1')
       9 - access("T1"."EPC_ID"="T2"."EPC_ID")
      10 - filter(("T0"."BUSINESS_LOCATION_URI"='businesslocation_ADD' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_DELETE' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE1' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE10' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE11' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE12' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE2' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE3' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE4' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE5' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE6' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE7' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE8' OR
                  "T0"."BUSINESS_LOCATION_URI"='businesslocation_OBSERVE9') AND (("T0"."EVENT_TYPE"='AGGREGATIO
                  OR "T0"."EVENT_TYPE"='TRANSACTION') AND "T1"."PARENT_EVENT_EPC_ID" IS NOT NULL OR
                  "T0"."EVENT_TYPE"='OBJECT'))
      11 - access("T0"."EVENT_ID"="T1"."EVENT_ID")
      13 - access("T0"."EVENT_ID"="T5"."EVENT_ID")
      15 - access("T5"."EPC_ID"="T6"."EPC_ID"(+))

  • Need help in insert statment query

    Hi,
    I have a table T1 with values like
    col1
    1
    2
    3
    4
    I need to write insert statment for t2 as
    insert into t2(col1,col2) values ('AA',select col1 from t1);
    The output of T2 should be
    col1 col2
    AA 1
    AA 2
    AA 3
    AA 4
    Any help in modifying the query.
    Ashish

    What is wrong with this?
    INSERT INTO id_own_dw.id_t_dw_org_dq_tgt
           (cost_center_cod_vc_old,
            cost_center_cod_vc_new
         SELECT '3016052',<<<_-- this you can replace with your varibale in pl/sql block
                cost_center_cod_vc
           FROM id_own_dw.id_t_dw_msl_org_cctr2mkdiv
          WHERE busi_unit_cod_vc = '3016496'

  • I need help with a SELECT query - help!

    Hello, I need help with a select statement.
    I have a table with 2 fields as shown below
    Name | Type
    John | 1
    John | 2
    John | 3
    Paul | 1
    Paul | 2
    Paul | 3
    Mark | 1
    Mark | 2
    I need a query that returns everything where the name has type 1 or 2 but not type 3. So in the example above the qery should bring back all the "Mark" records.
    Thanks,
    Ian

    Or, if the types are sequential from 1 upwards you could simply do:-
    SQL> create table t as
      2  select 'John' as name, 1 as type from dual union
      3  select 'John',2 from dual union
      4  select 'John',3 from dual union
      5  select 'Paul',1 from dual union
      6  select 'Paul',2 from dual union
      7  select 'Paul',3 from dual union
      8  select 'Paul',4 from dual union
      9  select 'Mark',1 from dual union
    10  select 'Mark',2 from dual;
    Table created.
    SQL> select name
      2  from t
      3  group by name
      4  having count(*) <= 2;
    NAME
    Mark
    SQL>Or another alternative if they aren't sequential:
    SQL> ed
    Wrote file afiedt.buf
      1  select name from (
      2    select name, max(type) t
      3    from t
      4    group by name
      5    )
      6* where t < 3
    SQL> /
    NAME
    Mark
    SQL>Message was edited by:
    blushadow

  • Need Help! Ad Hoc Query in HR Tables

    Dear Friends,
    I need to create a adhoc query for the following tables.
    PA*
    HRP1000
    HRP1001
    But I could select only PNPCE LDB... I do not know how to define one and get the information out from PA* and HRP1000 and HRP1001 info types....
    Please help.
    Thanks,
    Joy

    Hi Joydip,
    Go to transaction SQ02, from the Edit menu go to "Change Infotype Selection" step. Go to the end of the tree structure. From "Infotypes of related objects" select the respective organizational object (e.g. org unit, position) & respective relationship. When you click on these items & confirm your selection, they all apeear in the infotype tree structure at the left part of the SQ02 screen. You can use them just like other info types of PNPCE logical DB.
    Regards,
    Dilek

  • Need help on the below query.

    Hi All,
    I've a query given below..
    SELECT W.WONUM,
         W.STATUS,
         WS.CHANGEDATE,
         EH.OLD_RATE
         FROM
         WORKORDER W,
         WOSTATUS WS,
         ESTIMATE_HEADER@GQMFOF EH
    WHERE WS.CHANGEDATE BETWEEN '01-Oct-2009' AND '1-Nov-2009'
    AND W.WONUM = WS.WONUM
    AND EH.OLD_RATE = 'N'
    AND WS.WOSTATUS = 'CLOSE';
    I would like to get All the data which status =closed in the month of Oct for Old rate,
    So for this i am writing the query above. But not getting the o/p.
    It is giving me that " Table/View doesn't exist.
    There 2 schemas MAXIMO,GQMMGR..
    DBlinks are GQMFOF,MAXFOFNC..
    Can anyone help me while writing the above query...
    Regards,
    gr.

    A question was asked in your other thread. But the problem was you dint care to give an answer.
    Dont open duplicate post.
    I need help on the below problem..

  • Need help on a sql query

    Hi Friends,
    I am trying to load Employees and their Assignments using APIs.
    I have various columns in my staging table like Last Name, First Name, etc., but I need help in writing query in the cursor especially for columns Emp Number and Supervisor Number.
    I have data as below
    Emp_Number     Supervisor_Number
    GE0002               GE0064
    GE0064               EG0009
    EG0009               EG0001
    100009                EG0001
    EG0001               TU0001
    Cursor I write will process the data in the same order as above, but here the problem is...
    When it processes first row, it checks for supervisor GE0064 which do not exist and so it errors out.
    Similarly for second row, it checks for supervisor EG0009 which again do not exist and so it errors out.
    So in order to prevent this, the cursor should process the rows as below
    Emp_Number     Supervisor_Number
    EG0001               TU0001
    EG0009               EG0001
    GE0064               EG0009
    GE0002               GE0064
    100009                EG0001
    By this way, Supervisor should be defined first as an employee and then it can be used as a supervisor for other employees
    is there a way that I can get the output as above(second set of data), when the table has records randomly as above(first set of data)
    Appreciate your help!
    Thanks,
    Srikanth

    Srikanth wrote:
    ... but the number of records returned by above query are lot more than number of records in the table.
    Why did the number go up?
    It's something only you can find out
    Maybe some Emp have several Supervisor(s) like
    with
    t as
    (select 'GE0002' Emp,'GE0064' Supervisor from dual union all
    select 'GE0064','EG0009' from dual union all
    select 'EG0009','EG0001' from dual union all
    select 'GE0064','100009' from dual union all
    select '100009','EG0001' from dual union all
    select 'EG0001','TU0001' from dual
    select Emp,Supervisor,lpad('_',3 * (level - 1),'_')||Emp indent
      from (select Emp,Supervisor
              from t
            union all
            select supervisor,null
              from t tt
             where not exists(select null
                                from t
                               where emp = tt.supervisor
    start with Supervisor is null
    connect by prior Emp = Supervisor
    EMP
    SUPERVISOR
    INDENT
    TU0001
    TU0001
    EG0001
    TU0001
    ___EG0001
    100009
    EG0001
    ______100009
    GE0064
    100009
    _________GE0064
    GE0002
    GE0064
    ____________GE0002
    EG0009
    EG0001
    ______EG0009
    GE0064
    EG0009
    _________GE0064
    GE0002
    GE0064
    ____________GE0002
    Regards
    Etbin

  • Need help in writing the query

    The initial data is as follows:
    ID PARENT_ID
    =============
    1 NULL
    2 NULL
    3 2
    4 6
    5 3
    6 7
    7 4
    8 NULL
    but output is as follows in such way that Parent_Id should be displayed in ID place
    ID PARENT_ID
    =============
    1 NULL
    2 NULL
    3 2
    8 NULL
    6 8
    4 6
    5 3
    7 4
    Can any one help how resolve this query?
    Thanks in advance

    Your output is inconsistent with initial data :) But
    select * from t start with parent_id is null connect by parent_id = prior id;

  • Need help in the following query

    Hi ,
    I have the following query to pull out data for a particular timeperiod( campaign)
    select
    da.acct_nr,smas.mrkt_id,smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
    ,smas.stf_ind,da1.acct_nr,
    smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
    ,smas.stf_ind,da1.acct_nr,prev.*
    From cdw.sum_mrkt_acct_sls smas
    join codi.dim_acct da
    on (smas.mrkt_id = da.mrkt_id and smas.acct_key = da.acct_key)
    join codi.dim_acct da1
    on (smas.mrkt_id = da1.mrkt_id and smas.UPLN_acct_key = da1.ACCT_KEY)
    where smas.acct_key in
    select dwnln_acct_key from codi.dim_ldrshp_genlgy
    where mrkt_id = 66 and fld_sls_cmpgn_perd_id = 20100304
    and root_upln_acct_key = (select acct_key from codi.dim_acct where acct_nr = '0032622' and mrkt_id = 66)
    and
    smas.mrkt_id = 66
    and smas.fld_sls_cmpgn_perd_id = 20100304
    and smas.sls_org_key <> -100
    order by 1
    So this query will pull out data for campaign 20100304
    No i want to modify the query to pull out data for 3 such campaigns.
    for a smas.acct_key
    so data will
    smas.acct_key all the data for 1st campaign , all the data for 2nd campaign. all the data for 3rd campaign
    Could you please help in modifying this query.
    Thanks

    How about this ??
    select da.acct_nr,
           smas.mrkt_id,
           smas.fld_sls_cmpgn_perd_id,
           smas.acct_key,
           smas.upln_acct_key,
           smas.awrd_sls_amt,
           smas.fld_net_sls_amt,
           smas.stf_ind,
           da1.acct_nr,
           smas.fld_sls_cmpgn_perd_id,
           smas.acct_key,
           smas.upln_acct_key,
           smas.awrd_sls_amt,
           smas.fld_net_sls_amt,
           smas.stf_ind,
           da1.acct_nr,
           prev.*
      From cdw.sum_mrkt_acct_sls smas
      join codi.dim_acct da on (smas.mrkt_id = da.mrkt_id and
                               smas.acct_key = da.acct_key)
      join codi.dim_acct da1 on (smas.mrkt_id = da1.mrkt_id and
                                smas.UPLN_acct_key = da1.ACCT_KEY)
    where smas.acct_key in (select dwnln_acct_key
                               from codi.dim_ldrshp_genlgy
                              where mrkt_id = 66
                                and fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
                                and root_upln_acct_key =
                                    (select acct_key
                                       from codi.dim_acct
                                      where acct_nr = '0032622'
                                        and mrkt_id = 66))
       and smas.mrkt_id = 66
       and smas.fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
       and smas.sls_org_key - 100
    order by 1

  • Need help on oracle sql query

    Hi team,
    Please help me on below query,
    I have table like given below
    Tran_Id  tran_date   amount. Actorid
       1.         10-apr-15.   100.         1
       2.         11-apr-15.   100.         1
       3.         11-apr-15.   900.         1
       4.         12-apr-15.   100.         1
       5.         13-apr-15.   350.         1
       6.         14-apr-15.   400.         1
    Now please find the query,
    I want all the actor ids whos tran amount
    >1500 and the  date when the tran amount
    Has breached
    Ex:
    Actor-id.  Breached-date.    Total
      1.              13-apr-15.            1900
    How can I write a query for above requirement?
    Regards,
    Rajendra

    Your solution (same as Saubhik's) is incorrect. Look at source data - multiple transactions can occur same day. Therefore, your qury will return wrong results if breached amount is 1000:
    with trans as (
    select  1  tran_Id, to_date('10-apr-15', 'dd-mon-yy') tran_date,  100 amount, 1 actorid from dual union all
    select  2,  to_date('11-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
    select  3,  to_date('11-apr-15', 'dd-mon-yy'), 900, 1 from dual union all
    select  4,  to_date('12-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
    select  5,  to_date('13-apr-15', 'dd-mon-yy'), 350, 1 from dual union all
    select  6,  to_date('14-apr-15', 'dd-mon-yy'), 400, 1 from dual union all
    select  7,  to_date('12-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
    select  8,  to_date('13-apr-15', 'dd-mon-yy'), 1200, 2 from dual union all
    select  9,  to_date('14-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
    select  10,  to_date('15-apr-15', 'dd-mon-yy'), 300, 2 from dual
    trans_running_tot as (
    select tran_id, tran_date,
      sum(amount) over (partition by actorid order by tran_date) tot_amt, actorid
    from trans
    trans_ranked as (
    select actorid,tran_id, tran_date,
      rank() over (partition by actorid order by tot_amt) rk
    from trans_running_tot
    where tot_amt > 1000
    select * from trans_ranked where rk=1
       ACTORID    TRAN_ID TRAN_DATE         RK
             1          2 11-APR-15          1 -- here total amount was only 200
             1          3 11-APR-15          1
             2          8 13-APR-15          1
    SQL>
    As you can see, 2 rows were returned for actor 1. Why? Default for analytic ORDER BY is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. Therefore, all rows with same transation_date will fall into same window:
    SQL>  with trans as (
      2   select  1  tran_Id, to_date('10-apr-15', 'dd-mon-yy') tran_date,  100 amount, 1 actorid from dual union all
      3   select  2,  to_date('11-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
      4   select  3,  to_date('11-apr-15', 'dd-mon-yy'), 900, 1 from dual union all
      5   select  4,  to_date('12-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
      6   select  5,  to_date('13-apr-15', 'dd-mon-yy'), 350, 1 from dual union all
      7   select  6,  to_date('14-apr-15', 'dd-mon-yy'), 400, 1 from dual union all
      8   select  7,  to_date('12-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
      9   select  8,  to_date('13-apr-15', 'dd-mon-yy'), 1200, 2 from dual union all
    10   select  9,  to_date('14-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
    11   select  10,  to_date('15-apr-15', 'dd-mon-yy'), 300, 2 from dual
    12   )
    13  select tran_id, tran_date,
    14    sum(amount) over (partition by actorid order by tran_date) tot_amt, actorid
    15  from trans
    16  /
       TRAN_ID TRAN_DATE    TOT_AMT    ACTORID
             1 10-APR-15        100          1
             2 11-APR-15       1100          1
             3 11-APR-15       1100          1
             4 12-APR-15       1200          1
             5 13-APR-15       1550          1
             6 14-APR-15       1950          1
             7 12-APR-15        300          2
             8 13-APR-15       1500          2
             9 14-APR-15       1800          2
            10 15-APR-15       2100          2
    10 rows selected.
    SQL>
    So correct solution is to ORDER BY transation id. Also, just in case if amount can be 0, we should add tranaction id when ordering by sum:
    with trans as (
    select  1  tran_Id, to_date('10-apr-15', 'dd-mon-yy') tran_date,  100 amount, 1 actorid from dual union all
    select  2,  to_date('11-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
    select  3,  to_date('11-apr-15', 'dd-mon-yy'), 900, 1 from dual union all
    select  4,  to_date('12-apr-15', 'dd-mon-yy'), 100, 1 from dual union all
    select  5,  to_date('13-apr-15', 'dd-mon-yy'), 350, 1 from dual union all
    select  6,  to_date('14-apr-15', 'dd-mon-yy'), 400, 1 from dual union all
    select  7,  to_date('12-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
    select  8,  to_date('13-apr-15', 'dd-mon-yy'), 1200, 2 from dual union all
    select  9,  to_date('14-apr-15', 'dd-mon-yy'), 300, 2 from dual union all
    select  10,  to_date('15-apr-15', 'dd-mon-yy'), 300, 2 from dual
    trans_running_tot as (
    select tran_id, tran_date,
      sum(amount) over (partition by actorid order by tran_id) tot_amt, actorid
    from trans
    trans_ranked as (
    select actorid,tran_id, tran_date,
      rank() over (partition by actorid order by tot_amt,tran_id) rk
    from trans_running_tot
    where tot_amt > 1000
    select * from trans_ranked where rk=1
       ACTORID    TRAN_ID TRAN_DATE         RK
             1          3 11-APR-15          1
             2          8 13-APR-15          1
    SQL>
    SY.

  • Help needed in tuning a complex query

    Hi,
    I am running Oracle 9i on Solaris 9.
    I have the following query that's running for more than 20 hours and not finishing. I am attaching TOAD explain plan and number of records of the tables. If somebody can give some ideas, I will really appreciate that.
    Thanks.
    SELECT
    a.AGREMENT_number, SUBSTR (d.product_number, 11, 9),
    SUBSTR (d.product_number, 1, 9), SUBSTR (d.product_name, 1, 80),
    'TERMS', e.valuenumber,
    NVL (SUBSTR (j.valuestring, 1, 1),
    NVL ((SELECT 'P'
    FROM PCPINDASSN_CLNT n
    WHERE (k.state = n.state OR n.state = 'US')
    AND m.value_string = n.specialty),
    'S'
    SUBSTR (i.valuestring, 1, 9),
    GREATEST (NVL (d.date_value_2, a.effectivestartdate),
    NVL (g.valuedate, a.effectivestartdate)
    LEAST (NVL (d.date_value_1, NVL (a.effectiveenddate, '31-DEC-9999')),
    NVL (h.valuedate, NVL (a.effectiveenddate, '31-DEC-9999'))
    FROM AGREMENT a,
    AGREMENTREVI b,
    AGREMENTLR c,
    LINEREVI d,
    VLTABL e,
    VLTABL f,
    VLTABL g,
    VLTABL h,
    VLTABL i,
    VLTABL j,
    VEND_PHY_AGREMENT_CLNT k,
    PARTICIPANT l,
    CUSTPROP m
    WHERE a.ID = b.AGREMENTID
    AND a.REVISION = b.REVISION
    AND a.ID = c.AGREMENT_id
    AND a.REVISION = c.AGREMENT_REVISION
    AND c.LINEREVI_ID = d.LINEREVI_ID
    AND a.ID = e.AGREMENTID
    AND a.REVISION = e.REVISION
    AND e.CHNG_ID = (SELECT CHNG_ID
    FROM CHANGING
    WHERE NAME = 'Ct. MSTR 01')
    AND a.ID = f.AGREMENTID
    AND a.REVISION = f.REVISION
    AND f.CHNG_ID = (SELECT CHNG_ID
    FROM CHANGING
    WHERE NAME = 'Ct. MSTR 01 Transaction Type')
    AND a.ID = g.AGREMENTID
    AND a.REVISION = g.REVISION
    AND g.CHNG_ID = (SELECT CHNG_ID
    FROM CHANGING
    WHERE NAME = 'Ct. MSTR 01 Effective Date')
    AND a.ID = h.AGREMENTID
    AND a.REVISION = h.REVISION
    AND h.CHNG_ID = (SELECT CHNG_ID
    FROM CHANGING
    WHERE NAME = 'Ct. MSTR 01 Cancel Date')
    AND a.ID = i.AGREMENTID
    AND a.REVISION = i.REVISION
    AND i.CHNG_ID = (SELECT CHNG_ID
    FROM CHANGING
    WHERE NAME = 'Ct. MSTR 01 NWRK Number')
    AND a.ID = j.AGREMENTID
    AND a.REVISION = j.REVISION
    AND j.CHNG_ID = (SELECT CHNG_ID
    FROM CHANGING
    WHERE NAME = 'Ct. MSTR 01 PCP Override')
    AND REPLACE (d.product_number, ',') = l.external_system_id
    AND l.PARTICIPANT_id = m.bo_key
    AND m.property_pkid = (SELECT pkid
    FROM CUPROP
    WHERE NAME = 'prov_spclty_ind')
    AND e.valuenumber IS NOT NULL
    AND UPPER (NVL (f.valuestring, 'Processed')) NOT LIKE '%CANCEL%'
    AND a.status IN ('Active', 'Executed')
    AND LEAST (NVL (d.date_value_1, NVL (a.effectiveenddate, '31-DEC-9999')),
    NVL (h.valuedate, NVL (a.effectiveenddate, '31-DEC-9999'))
    ) > SYSDATE
    AND a.AGREMENT_NUMBER = k.VENDDOCID
    AND k.delta IS NULL;
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=FIRST_ROWS          1           65641                     
    TABLE ACCESS FULL     VEND.PCPINDASSN_CLNT     1      7      15                     
    NESTED LOOPS          1      822      65641                     
    NESTED LOOPS          1      750      65637                     
    NESTED LOOPS          1      700      65634                     
    NESTED LOOPS          1      690      65171                     
    NESTED LOOPS          1      616      65169                     
    NESTED LOOPS          1      546      65166                     
    NESTED LOOPS          1      511      65164                     
    NESTED LOOPS          1      434      65160                     
    NESTED LOOPS          1      357      65156                     
    NESTED LOOPS          1      283      65152                     
    NESTED LOOPS          3      627      65140                     
    NESTED LOOPS          826      109 K     61836                     
    TABLE ACCESS BY INDEX ROWID     VEND.VLTABL     2 K     216 K     53184                     
    INDEX RANGE SCAN     VEND.VLTABL_CHNG_ID_INDX     57 K          448                     
    TABLE ACCESS BY INDEX ROWID     VEND.CHANGING     1      65      2                     
    INDEX UNIQUE SCAN     VEND.NAME_APK     1           1                     
    TABLE ACCESS BY INDEX ROWID     VEND.AGREMENT     1      59      3                     
    INDEX UNIQUE SCAN     VEND.AGREMENT_PK     1           2                     
    TABLE ACCESS BY INDEX ROWID     VEND.VLTABL     1      73      4                     
    INDEX UNIQUE SCAN     VEND.VLTABL_PK     1           3                     
    TABLE ACCESS BY INDEX ROWID     VEND.CHANGING     1      65      2                     
    INDEX UNIQUE SCAN     VEND.NAME_APK     1           1                     
    TABLE ACCESS BY INDEX ROWID     VEND.VLTABL     1      74      4                     
    INDEX UNIQUE SCAN     VEND.VLTABL_PK     1           3                     
    TABLE ACCESS BY INDEX ROWID     VEND.CHANGING     1      65      2                     
    INDEX UNIQUE SCAN     VEND.NAME_APK     1           1                     
    TABLE ACCESS BY INDEX ROWID     VEND.VLTABL     1      74      4                     
    INDEX UNIQUE SCAN     VEND.VLTABL_PK     1           3                     
    TABLE ACCESS BY INDEX ROWID     VEND.CHANGING     1      65      2                     
    INDEX UNIQUE SCAN     VEND.NAME_APK     1           1                     
    TABLE ACCESS BY INDEX ROWID     VEND.VLTABL     1      77      4                     
    INDEX UNIQUE SCAN     VEND.VLTABL_PK     1           3                     
    TABLE ACCESS BY INDEX ROWID     VEND.CHANGING     1      65      2                     
    INDEX UNIQUE SCAN     VEND.NAME_APK     1           1                     
    TABLE ACCESS BY INDEX ROWID     VEND.VLTABL     1      77      4                     
    INDEX UNIQUE SCAN     VEND.VLTABL_PK     1           3                     
    TABLE ACCESS BY INDEX ROWID     VEND.CHANGING     1      65      2                     
    INDEX UNIQUE SCAN     VEND.NAME_APK     1           1                     
    TABLE ACCESS BY INDEX ROWID     VEND.AGREMENTREVI     1      35      2                     
    INDEX UNIQUE SCAN     VEND.AGREMENTREVI_PK     1           1                     
    INDEX RANGE SCAN     VEND.PK_AGREMENTLR     6      420      3                     
    TABLE ACCESS BY INDEX ROWID     VEND.LINEREVI     1      74      2                     
    INDEX UNIQUE SCAN     VEND.SYS_C004896     1           1                     
    TABLE ACCESS FULL     VEND.VEND_PHY_AGREMENT_CLNT     1      10      463                     
    TABLE ACCESS BY INDEX ROWID     VEND.PARTICIPANT     1      50      3                     
    INDEX RANGE SCAN     VEND.PARTICIPANT_EXTERNAL_SYSTEM_ID_CUST1     1           2                     
    TABLE ACCESS BY INDEX ROWID     VEND.CUSTPROP     1      72      4                     
    INDEX RANGE SCAN     VEND.CUSTOMPROPVAL_KEY_PK_VAL     1           3                     
    TABLE ACCESS BY INDEX ROWID     VEND.CUPROP     1      47      1                     
    INDEX UNIQUE SCAN     VEND.UNIQUE_NAME     1                               
    Table Name               Records
    CUPROP                    21
    VEND_PHY_AGREMENT_CLNT          306034
    AGREMENTREVI               455167
    LINEREVI               1425077
    AGREMENT               1797443
    PARTICIPANT               3444813
    AGREMENTLR               10129747
    CUSTPROP               47342607
    VLTABL                    328107500
    *********************************************************************************************************************

    user578671 if you cannot take constructive advise and need to have it sugar coated, please do not post in a public forum.
    Toad explain plans are Re: Tool for Explain Plan?? for anyone that cannot see your monitor, unformatted explain plans are also useless.
    The link provided by SomeoneElse shows you what information is needed and how to post it in a way that people can read it and help you. Got it?

Maybe you are looking for

  • Details of Production Orders (Archived)

    Dear SAP Buddy, Please can anyone tell how to get the Document Goods Movement list of archived Production orders alongwith the G/L accounts assigned with all Documents Goods movement Awaiting reply from all genious SAP Buddy Answer will be highly app

  • Process hdbdaemon HDB Daemon not running

    Hi. I was working on Hana Studio, i wanted to do a recovery, so Hana Studio stopped the instance, so i click on cancel the recovery and when i went to start again the instance it showed me this Error: So i went to Linux Server (hanab1) to start manua

  • E61 - Email config

    Hi everyone. I am looking to get the E61 but would like to confident that it can be configured to my work Exchange server for push mail. We use Windows Small Business Server 2003, MS exchange, cisco firewall. I am not a techy ,(could you tell!) but o

  • Mac Pro Late 2013 Cubase 8 Problems

    Hello I'm currently running Yosemite on the late 2013 Mac Pro. I'm having major issues with Cubase 8. When i select my Virus TI Channel, the whole program crashes. Sometimes it just randomly crashes. Also, vst2 plugins are really laggy, and i can't f

  • My iPhone's iMovie, the clip sequence/audio/timing all off, a serious problem since last update

    clip sequence and timing won't save at the desired position, having to go through the movie again and again re-timing it, just wont remain in place to produce desired imovie, worthless if nothing will set as you wish. An error after last update.