How to tune this Bex report

The report show display the unique units price for the same cust # and material
Example:
Sales Doc #     Item #     Cust #     SBU     SPL      Material      Unit price
100     10     1763     10     10200     CX00-23343     1.0
101     10     1763     10     10200     CX00-23343     1.0
102     10     1763     10     10200     CX00-23343     1.5
We need to show below in the report for the above example:
Sales Doc #     Item #     Cust #     SBU     SPL      Material      Unit price
100     10     1763     10     10200     CX00-23343     1.0
101     10     1763     10     10200     CX00-23343     1.5
Please give your much needed inputs
Thanks
Vishal

Hi Arun,
This is how it is.. and in this case we need to ignore the row with sales doc 102. We need to display the unique units price for the same cust # and material#.
so if have
Doc #    Item #        Cust #     SBU     SPL      Material              Unit price
101     10     1763     10     10200     CX00-23343     1.0
102     10     1763     10     10200     CX00-23343     1.5
We need to display only
Doc #    Item #        Cust #     SBU     SPL      Material              Unit price
101     10     1763     10     10200     CX00-23343     1.0
Thanks
Vishal

Similar Messages

  • How to tune this query for the improve performance ?

    Hi All,
    How to tune this query for the improve performance ?
    select a.claim_number,a.pay_cd,a.claim_occurrence_number,
    case
    when sum(case
    when a.payment_status_cd ='0'
    then a.payment_est_amt
    else 0
    end
    )=0
    then 0
    else (sum(case
    when a.payment_status_cd='0'and a.payment_est_amt > 0
    then a.payment_est_amt
    else 0
    end)
    - sum(case
    when a.payment_status_cd<>'0'
    then a.payment_amt
    else 0
    end))
    end as estimate
    from ins_claim_payment a
    where a.as_of_date between '31-jan-03' and '30-aug-06'
    and ( a.data_source = '25' or (a.data_source between '27' and '29'))
    and substr(a.pay_cd,1,1) IN ('2','3','4','8','9')
    group by a.claim_number, a.pay_cd, a.claim_occurrence_number
    Thank you,
    Mcka

    Mcka
    As well as EXPLAIN PLAN, let us know what proportion of rows are visited by this query. It may be that it is not using a full table scan when it should (or vice versa).
    And of course we'd need to know what indexes are available, and how selective they are for the predicated you have in this query ...
    Regards Nigel

  • How to tune this SQL?

    What this SQL did is to generate a report like how many rows for each tp_stts when ims_toms_msge_type='TOMS NEW' (or 'TOMS CNCLO'). also, its corresponding total number for each ims_toms_msge_type.
    Here is the sample:
    Rownum    H1            TP_STTS                          COUNT        IMS_TOMS_MSGE_TYPE    H   FILTERTYPE
    1     Trades     Block Key Data Error                      594           TOMS NEW             A     MSL
    2          Allocation Data Error                      334           TOMS NEW             A     MSL
    3          Manual Processing Required                29           TOMS NEW             A      MSL
    4          Manual Removal No Processing Required     67           TOMS NEW             A      MSL
    5          Waiting For Authorization                 2            TOMS NEW             A     MSL
    6           Auto NAK                             19764          TOMS NEW             B     SLS
    7           Validated                             165023         TOMS NEW             B     SLS
    8     GRAND TOTAL                                    185813          TOMS NEW              H     MSL
    9     Cancel     Auto NAK                              37             TOMS CNCLO        X       MSL
    10          Manual Processing Required   114                    TOMS CNCLO          X      MSL
    11          Manually Processed              278                   TOMS CNCLO     X     MSL
    12     CANCEL GRAND TOTAL                        429                TOMS CNCLO           Z      MSLSQL statement as below:
    SELECT ROWNUM, MSGS.* FROM (with FTMReport as (
           select tp_stts, ims_toms_msge_type, count(*) count  from ims_trde, ims_toms_msge
                    where  ( IMS_TRDE.PRCSG_GRP_ID  = 5  )  AND  ( IMS_TRDE.IMS_TRDE_RCPT_DTTM  >= TO_DATE('12/01/2009 00:00', 'MM/DD/YYYY HH24:MI') AND IMS_TRDE.IMS_TRDE_RCPT_DTTM <= (TO_DATE('12/28/2009 23:59', 'MM/DD/YYYY HH24:MI'))  )  AND (IMS_TRDE.GRS_TRX_TYPE NOT IN ('INJECTION','WITHDRAWAL','PAYMENT') OR IMS_TRDE.GRS_TRX_TYPE IS NULL) AND (IMS_TRDE.SSC_INVST_TYPE != 'FC' OR IMS_TRDE.SSC_INVST_TYPE IS NULL) AND (IMS_TRDE.SERVICE_TYPE='FS' OR IMS_TRDE.SERVICE_TYPE='CO')  AND 1=1 
        and IMS_TRDE.SERVICE_TYPE='FS'    and  1=1  and ims_trde.ims_trde_oid = ims_toms_msge.ims_trde_oid
           group by tp_stts, ims_toms_msge_type
          select 'GRAND TOTAL' H1,  null tp_stts, sum(Count) count , ims_toms_msge_type ,'H', 'MSL' FilterType
                   from FTMReport  where  ims_toms_msge_type in ('TOMS NEW') group by ims_toms_msge_type
        union
          select 'CANCEL GRAND TOTAL' H1,  null tp_stts, sum(Count) count, ims_toms_msge_type ,'Z', 'MSL' FilterType 
                   from FTMReport where  ims_toms_msge_type in ('TOMS CNCLO') group by ims_toms_msge_type
        union
          select DECODE(rownum, 1, 'Trades') H1, tp_stts, count, ims_toms_msge_type , 'A' , 'MSL' FilterType
                   from FTMReport  where  ims_toms_msge_type in ('TOMS NEW') and tp_stts not in ('Validated','Auto NAK','Manual NAK')
        union
          select ' ' H1, tp_stts, count, ims_toms_msge_type , 'B' , 'SLS' FilterType
                   from FTMReport where  ims_toms_msge_type in ('TOMS NEW') and tp_stts in ('Validated','Auto NAK','Manual NAK')
        union
          select DECODE(rownum, 1, 'Cancel') H1, tp_stts, count, ims_toms_msge_type , 'X' , 'MSL' FilterType
                   from FTMReport where  ims_toms_msge_type in ('TOMS CNCLO') order by 5,6
        ) MSGS;Explain plan as below:
    | Id  | Operation                           |  Name                        | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT                    |                              |   193 | 12738 |    32 |
    |   1 |  COUNT                              |                              |       |       |       |
    |   2 |   VIEW                              |                              |   193 | 12738 |    32 |
    |   4 |    TEMP TABLE TRANSFORMATION        |                              |       |       |       |
    |   3 |     RECURSIVE EXECUTION             | SYS_LE_4_0                   |       |       |       |
    |   0 |      INSERT STATEMENT               |                              |    61 |  4575 |  9264 |
    |   1 |       LOAD AS SELECT                |                              |       |       |       |
    |   2 |        SORT GROUP BY                |                              |    61 |  4575 |  9264 |
    |   3 |         NESTED LOOPS                |                              |  1604 |   117K|  9251 |
    |*  4 |          TABLE ACCESS BY INDEX ROWID| IMS_TRDE                     |  1603 | 80150 |  6045 |
    |*  5 |           INDEX RANGE SCAN          | IMS_TRDE_INDX4               |   539K|       |  3917 |
    |*  6 |          INDEX RANGE SCAN           | IMS_TOMS_MSGE_INDX1          |     1 |    25 |     2 |
    |   5 |     SORT UNIQUE                     |                              |   193 |  8831 |    30 |
    |   6 |      UNION-ALL                      |                              |       |       |       |
    |   7 |       SORT GROUP BY NOSORT          |                              |     5 |   115 |     6 |
    |*  8 |        VIEW                         |                              |    61 |  1403 |     2 |
    |   9 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |  10 |       SORT GROUP BY NOSORT          |                              |     5 |   115 |     6 |
    |* 11 |        VIEW                         |                              |    61 |  1403 |     2 |
    |  12 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |  13 |       COUNT                         |                              |       |       |       |
    |* 14 |        VIEW                         |                              |    61 |  2867 |     2 |
    |  15 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |* 16 |       VIEW                          |                              |    61 |  2867 |     2 |
    |  17 |        TABLE ACCESS FULL            | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |  18 |       COUNT                         |                              |       |       |       |
    |* 19 |        VIEW                         |                              |    61 |  2867 |     2 |
    |  20 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    Predicate Information (identified by operation id):
       4 - filter(("IMS_TRDE"."GRS_TRX_TYPE"<>'INJECTION' AND "IMS_TRDE"."GRS_TRX_TYPE"<>'WITHDRAWAL'
                  AND "IMS_TRDE"."GRS_TRX_TYPE"<>'PAYMENT' OR "IMS_TRDE"."GRS_TRX_TYPE" IS NULL) AND
                  ("IMS_TRDE"."SSC_INVST_TYPE"<>'FC' OR "IMS_TRDE"."SSC_INVST_TYPE" IS NULL))
       5 - access("IMS_TRDE"."IMS_TRDE_RCPT_DTTM">=TO_DATE(' 2009-12-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "IMS_TRDE"."PRCSG_GRP_ID"=5 AND "IMS_TRDE"."SERVICE_TYPE"='FS' AND
                  "IMS_TRDE"."IMS_TRDE_RCPT_DTTM"<=TO_DATE(' 2009-12-28 23:59:00', 'syyyy-mm-dd hh24:mi:ss'))
           filter("IMS_TRDE"."PRCSG_GRP_ID"=5 AND "IMS_TRDE"."SERVICE_TYPE"='FS')
       6 - access("IMS_TRDE"."IMS_TRDE_OID"="IMS_TOMS_MSGE"."IMS_TRDE_OID")
       8 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS NEW')
      11 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS CNCLO')
      14 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS NEW' AND "FTMREPORT"."TP_STTS"<>'Validated'
                  AND "FTMREPORT"."TP_STTS"<>'Auto NAK' AND "FTMREPORT"."TP_STTS"<>'Manual NAK')
      16 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS NEW' AND ("FTMREPORT"."TP_STTS"='Auto NAK' OR
                  "FTMREPORT"."TP_STTS"='Manual NAK' OR "FTMREPORT"."TP_STTS"='Validated'))
      19 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS CNCLO')
    Note: cpu costing is offCould you guys tell me what is wrong with this sql and how to tune it?
    Is there any way to replace the UNION? Is using UNION a good idea?
    Can I use DECODE or CASE WHEN to simplify it? How?
    Also, could you help explain why there is SYS_LE_4_0, SYS_TEMP_0FD9D660F_B198D56F temporary segment? Is it caused by with FTMReport as ?
    Thanks
    Edited by: PhoenixBai on Dec 31, 2009 9:58 AM
    Edited by: PhoenixBai on Dec 31, 2009 12:08 PM
    Edited by: PhoenixBai on Dec 31, 2009 12:17 PM

    I consider using GROUP BY ROLLUP together with DECODE, CASE WHEN, but haven`t come out with a working sql yet:-(Some sample data to work with would have been much helpful. But we dont get that most of the time :(
    I came up with this.
                    select case when ims_toms_msge_type = 'TOMS NEW' then
                                     case when grouping(tp_stts) = 1 then 'GRAND TOTAL'
                                          when tp_stts not in ('Validated','Auto NAK','Manual NAK') then 'Trades'
                                     end
                                when ims_toms_msge_type = 'TOMS CNCLO' then
                                     case when grouping(tp_stts) = 1 then 'CANCEL GRAND TOTAL'
                                          when tp_stts in ('Validated','Auto NAK','Manual NAK') then 'Cancel'
                                     end
                           end h1,
                           tp_stts,
                           count(*) count,
                           ims_toms_msge_type,
                           case when ims_toms_msge_type = 'TOMS NEW' then
                                     case when grouping(tp_stts) = 1 then 'H'
                                          when tp_stts not in ('Validated','Auto NAK','Manual NAK') then 'A'
                                     end
                                when ims_toms_msge_type = 'TOMS CNCLO' then
                                     case when grouping(tp_stts) = 1 then 'Z'
                                          when tp_stts in ('Validated','Auto NAK','Manual NAK') then 'B'
                                     end
                           end flag,
                           'MSL' FilterType
                   from ims_trde,
                        ims_toms_msge
                     where IMS_TRDE.PRCSG_GRP_ID  = 5 
                       AND IMS_TRDE.IMS_TRDE_RCPT_DTTM  >= TO_DATE('12/01/2009 00:00', 'MM/DD/YYYY HH24:MI')
                       AND IMS_TRDE.IMS_TRDE_RCPT_DTTM <=  TO_DATE('12/28/2009 23:59', 'MM/DD/YYYY HH24:MI') 
                       AND (IMS_TRDE.GRS_TRX_TYPE NOT IN ('INJECTION','WITHDRAWAL','PAYMENT')
                        OR IMS_TRDE.GRS_TRX_TYPE IS NULL)
                       AND (IMS_TRDE.SSC_INVST_TYPE != 'FC'
                        OR IMS_TRDE.SSC_INVST_TYPE IS NULL)
                       AND (IMS_TRDE.SERVICE_TYPE = 'FS'
                        OR IMS_TRDE.SERVICE_TYPE = 'CO')
                       AND 1=1 
                     and IMS_TRDE.SERVICE_TYPE = 'FS'   
                     and  1=1 
                     and ims_trde.ims_trde_oid = ims_toms_msge.ims_trde_oid
                      group by rollup(ims_toms_msge_type, tp_stts)Not sure if this code works. Because i dint have the table or the data to test it. So if it has some error just fix it and give it a try. Do post the kind of output it gives. So that we can see if we can work with this solution.

  • How to assign a Bex report to the user role

    Hi Expert
    in the Excel, when you open a query, the system will display history, faviourate, infoarea, role button on the left side of the popup screen. if you click the role button, you can see the user authorized Bex report. now I have created a Bex report and I want to assign it to the user role.
    how to do that?
    does anyboday know which transcation or setting can solve this problem?
    thank you in advance!

    Hi,
    You need to add the object S_RS_COMP:
    S_RS_COMP: Authorizations for using different components for the query definition. This authorization object is very important for reporting
    The authorization object S_RS_COMP restricts query component activities. For example, it restricts if someone can create queries, change queries, or execute queries. You can restrict query creation, change, and execution by the InfoArea and InfoCube. If your company has one InfoCube for sales information and another for financial data, you can restrict a user to only those queries written for the sales InfoCube or the financial InfoCube.
    You could also use S_RS_COMP if you want to protect by query name. For example, you have an InfoCube for sales data. Every sales manager needs access to this InfoCube. However, sales managers in different lines of business are not allowed to execute the same query.
    Please visit:
    http://www.*********************/bw_security/bw_security_auth_obj_2.htm
    to know more about BW Objects.
    Hope it helps.
    Please award points if it is useful.
    Thanks & Regards,
    Santosh

  • How to design this complex report

    I'm getting crazy======
    my mdb file is like this.
    For example, "PointName" has many pointname, like C1, C2, C3..........,[they are vertical tunnels].
    For every point/tunnel, like C1,
    we mearsure it every few days, and get the displacement with the depth.
    Point C1 ---- 2014/2/19 ---- depth: -1 ---- it's displacement is 0.4
    And for the report, I want every point have a crosstab and graph.
    How to do this report, many thanks!!!

    Hi, Jamie
    I think I haven't say it clear. The final report is all C1 in one crosstab, all C2 in one crosstab.......this is the key.
    I followed as you say, it shows, there are many c1 and c2, and the crosstab is wrong.
    Then I tried to use subreport
    it shows
    I want one C1 and one C2 and so on, and all C1's data in one crosstab and all C2's data in one crosstab.
    That's it.
    A'm I clear? If not, please tell me. Thanks.

  • How to run a bex report in backround

    All,
    Could anybody tell me how to schedule a bacround job to run a bex report. It would be great if i could email the results also,
    I appreciate any help with points,
    Regards,
    Mike

    A reporting agent (RSREP TC) is replaced by broadcaster in 7.0, but what both do is execute the query in background and put it in  cache and you try to access the cache when you execute the web template which is techinically a query.
    thanks.
    Wond

  • How to tune this SQL (takes long time to come up with results)

    Dear all,
    I have sum SQL which takes long time ... can any one help me to tune this.... thank You
    SELECT SUM (n_amount)
    FROM (SELECT DECODE (v_payment_type,
    'D', n_amount,
    'C', -n_amount
    ) n_amount, v_vou_no
    FROM vouch_det a, temp_global_temp b
    WHERE a.v_vou_no = TO_CHAR (b.n_column2)
    AND b.n_column1 = :b5
    AND b.v_column1 IN (:b4, :b3)
    AND v_desc IN (SELECT v_trans_source_code
    FROM benefit_trans_source
    WHERE v_income_tax_app = :b6)
    AND v_lob_code = DECODE (:b1, :b2, v_lob_code, :b1)
    UNION ALL
    SELECT DECODE (v_payment_type,
    'D', n_amount,
    'C', -n_amount
    * -1 AS n_amount,
    v_vou_no
    FROM vouch_details a, temp_global_temp b
    WHERE a.v_vou_no = TO_CHAR (b.n_column2)
    AND b.n_column1 = :b5
    AND b.v_column1 IN (:b12, :b11, :b10, :b9, :b8, :b7)
    AND v_desc IN (SELECT v_trans_source_code
    FROM benefit_trans_source
    WHERE income_tax_app = :b6)
    AND v_lob_code = DECODE (:b1, :b2, v_lob_code, :b1));
    Thank You.....

    Thanks a lot,
    i did change the SQL it works fine but slows down my main query.... actually my main query is calling a function which does the sum......
    here is the query.....?
    select A.* from (SELECT a.n_agent_no, a.v_agent_code, a.n_channel_no, v_iden_no, a.n_cust_ref_no, a.v_agent_type, a.v_company_code,
    a.v_company_branch, a.v_it_no, bfn_get_agent_name(a.n_agent_no) agentname,
    PKG_AGE__TAX.GET_TAX_AMT(:P_FROM_DATE,:P_TO_DATE,:P_LOB_CODE,A.N_AGENT_NO)  comm,
    c.v_ird_region
    FROM agent_master a, agent_lob b, agency_region c
    WHERE a.n_agent_no = b.n_agent_no
    AND a.v_agency_region = c.v_agency_region
    AND :p_lob_code = DECODE(:p_lob_code,'ALL', 'ALL',b.v_line_of_business)
    AND :p_channel_no = DECODE(:p_channel_no,1000, 1000,a.n_channel_no)
    AND :p_agency_group = DECODE(:p_agency_group,'ALL', 'ALL',c.v_ird_region)
    group by a.n_agent_no, a.v_agent_code, a.n_channel_no, v_iden_no, a.n_cust_ref_no, a.v_agent_type, a.v_company_code, a.v_company_branch, a.v_it_no, bfn_get_agent_name(a.n_agent_no) ,
    BPG_AGENCY_GEN_ACL_TAX.BFN_GET_TAX_AMOUNT(:P_FROM_DATE,:P_TO_DATE,:P_LOB_CODE,A.N_AGENT_NO),
    c.v_ird_region
    ORDER BY c.v_ird_region, a.v_agent_code DESC)
    A
    WHERE (COMM < :P_VAL_IND OR      COMM >=:P_VAL_IND1);
    Any idea to make this faster....
    Thank You...

  • How to execute BW-Bex reports from SRM

    Hi
    Anyone know if there is an easy way of execute BW Bex reports directly from the SRM interface? Or is the easiest way to have the users start the Analyzer seperatly.
    We are running:
    SRM 4.0 (webb interface)
    BW 3.5
    Thanks and regards
    Pontus

    Hi
    Thanks for your reply.
    I can run that TC from the BW but not from SRM. It just says that TC does not exist in SRM.
    Best Regards
    Pontus

  • HOw to achieve this at report/query level

    Hi Experts
    Please update me how can i achieve this at query level
    Lets Consider Data in my Cube
    Dept_id--Date--
    Qty
    -101.01.20093-----
    -101.01.20095-----
    -101.01.20098-----
    -101.01.20091-----
    -101.01.20099-----
    That is how data is avaliable in my cube
    When i run the report the output is displayed as
    Dept_id--Date--
    Qty
    -101.01.200926-----
    That is what it actually do...it will sumirises into one record.....
    BUT
    My requirment is the query result should be ....with out summarisation
    Dept_id--Date--
    Qty
    -101.01.20093-----
    -101.01.20095-----
    -101.01.20098-----
    -101.01.20091-----
    -101.01.20099-----
    Please update me is there any setting i can make at query level

    Hi,
    By default data will be aggregated in Query.
    How come data available in Cube at different aggregation level...? due to request no or some other characteristic which is unique for each record...??
    If some other characteristic available, make it available that characteristic in rows to get desired result.
    Srini

  • How to tune this query

    Hi,
    Im trying to select the latest set of data from a table using a simple query for inserting into a new table.
    Details are given below.
    There are no indices for the table. Its taking around 18 sec.
    Pls advice on how to proceed so that I can bring down this time.
    Query:
    SELECT
    FROM
    M_UNDR M
    WHERE
    M.M_DATE = (SELECT MAX(M_DATE) FROM M_UNDR M1)
    AND
    M.M_TIME =
    SELECT MAX(M_TIME) FROM M_UNDR M2 WHERE M2.M_DATE = M.M_DATE
    AND
    M.U_TYPE NOT IN ('USD', 'GBP', 'EUR');
    SQL> select count(1) from m_undr;
      COUNT(1)
       2695446
    SQL>
    Version:
    SQL> select banner from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for Solaris: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Explain plan
    PLAN_TABLE_OUTPUT
    | Id  | Operation            | Name           | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |                |     1 |    95 | 19060 |
    |   1 |  HASH JOIN           |                |     1 |    95 | 12882 |
    |   2 |   VIEW               | VW_SQ_1        |   508 | 11176 |  6608 |
    |   3 |    HASH GROUP BY     |                |   508 | 10668 |  6608 |
    |   4 |     TABLE ACCESS FULL| M_UNDR |  2392K|    47M|  6186 |
    |   5 |   TABLE ACCESS FULL  | M_UNDR |  5594 |   398K|  6274 |
    |   6 |    SORT AGGREGATE    |                |     1 |     8 |       |
    |   7 |     TABLE ACCESS FULL| M_UNDR |  2392K|    18M|  6178 |
    SQL> sho parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      10.2.0.3
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     200
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    SQL> sho parameter DB_FILE_MULTI
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     16
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    Trace:
    SQL> set autotrace traceonly arraysize 100
    SQL> SELECT
      2  *
      3  FROM
      4  M_UNDR M
      5  WHERE
      6  M.M_DATE = (SELECT MAX(M_DATE) FROM M_UNDR M1)
      7  AND
      8  M.M_TIME =
      9  (
    10  SELECT MAX(M_TIME) FROM M_UNDR M2 WHERE M2.M_DATE = M.M_DATE
    11  )
    12  AND
    13  M.U_TYPE NOT IN ('USD', 'GBP', 'EUR');
    239 rows selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=19060 Card=1 Bytes
              =95)
       1    0   HASH JOIN (Cost=12882 Card=1 Bytes=95)
       2    1     VIEW OF 'VW_SQ_1' (VIEW) (Cost=6608 Card=508 Bytes=11176
       3    2       HASH (GROUP BY) (Cost=6608 Card=508 Bytes=10668)
       4    3         TABLE ACCESS (FULL) OF 'M_UNDR' (TABLE) (Cos
              t=6186 Card=2392724 Bytes=50247204)
       5    1     TABLE ACCESS (FULL) OF 'M_UNDR' (TABLE) (Cost=62
              74 Card=5594 Bytes=408362)
       6    5       SORT (AGGREGATE)
       7    6         TABLE ACCESS (FULL) OF 'M_UNDR' (TABLE) (Cos
              t=6178 Card=2392724 Bytes=19141792)
    Statistics
              1  recursive calls
              0  db block gets
          91479  consistent gets
           4830  physical reads
              0  redo size
          15457  bytes sent via SQL*Net to client
            359  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
            239  rows processed
    SQL> disconnect
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  0br4mzjgj63dw, child number 0
    SELECT /*+ gather_plan_statistics */ * FROM M_UNDR M WHERE M.M_DATE = (SELECT MAX(M_DATE) FROM
    M_UNDR M1) AND M.M_TIME = ( SELECT MAX(M_TIME) FROM M_UNDR M2 WHERE M2.M_DATE = M.M_DATE )
    AND M.U_TYPE NOT IN ('USD', 'GBP', 'EUR')
    Plan hash value: 1220141218
    | Id  | Operation            | Name           | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |*  1 |  HASH JOIN           |                |      1 |      1 |    239 |00:00:06.94 |   91479 |  1114K|  1114K| 1209K (0)|
    |   2 |   VIEW               | VW_SQ_1        |      1 |    508 |    607 |00:00:04.06 |   30492 |    |  |          |
    |   3 |    HASH GROUP BY     |                |      1 |    508 |    607 |00:00:04.06 |   30492 |    |  |          |
    |   4 |     TABLE ACCESS FULL| M_UNDR |      1 |   2392K|   2695K|00:00:00.01 |   30492 |    |  |          |
    |*  5 |   TABLE ACCESS FULL  | M_UNDR |      1 |   5594 |   5497 |00:00:02.81 |   60987 |    |  |          |
    |   6 |    SORT AGGREGATE    |                |      1 |      1 |      1 |00:00:01.20 |   30492 |    |  |          |
    |   7 |     TABLE ACCESS FULL| M_UNDR |      1 |   2392K|   2695K|00:00:00.01 |   30492 |    |  |          |
    Predicate Information (identified by operation id):
       1 - access("M"."M_TIME"="VW_COL_1" AND "M_DATE"="M"."M_DATE")
       5 - filter(("M"."U_TYPE"<>'USD' AND "M"."U_TYPE"<>'GBP' AND "M"."U_TYPE"<>'EUR' AND "M"."M_DATE"=))
    26 rows selected.I have tried using rank as below. Didnt find any improvement.
    select * from
    SELECT
    m.*,
    rank() over (order by m_date desc, m_time desc) rnk
    FROM
    M_UNDR M
    WHERE
    M.U_TYPE NOT IN ('USD', 'GBP', 'EUR')
    where rnk  = 1Thanks in advance

    Hi,
    creating index on m_date and m_time did have gr8 impact on the plan.
    Query is completing in 2 sec now.
    Id  | Operation                      | Name               | Rows  | Bytes | Cost  |
       0 | SELECT STATEMENT               |                    |     1 |    73 |  6234 |
       1 |  TABLE ACCESS BY INDEX ROWID   | M_UNDR     |     2 |   146 |    51 |
       2 |   INDEX RANGE SCAN             | IND_M_UNDR |     2 |       |    49 |
       3 |    SORT AGGREGATE              |                    |     1 |    13 |       |
       4 |     FIRST ROW                  |                    |  5683 | 73879 |     6 |
       5 |      INDEX RANGE SCAN (MIN/MAX)| IND_M_UNDR |  5683 | 73879 |     6 |
       6 |    SORT AGGREGATE              |                    |     1 |     8 |       |
       7 |     INDEX FULL SCAN (MIN/MAX)  | IND_M_UNDR |  2392K|    18M|       |
    ------------------------------------------------------------------------------------Thanks for the help. Will check if there is any serious impact on insert.

  • How to tune this update statement?

    Hello,
    I have to solve the following task:
    Update every row in table A which has an appropriate row in table B and log what you have done in a log-table.
    It is possible that there are more than one fitting rows in table A for a row in table B.
    My first approach is looping over the table B and doing an update of table A for every entry in table B.
    This works and looks like this:
    Table A:
    PK number (This is the primary key of this table)
    KEY number
    Table B:
    KEY_OLD number
    KEY_NEW number
    Log table:
    PK number
    KEY_OLD number
    KEY_NEW number
    declare
      TYPE PK_TAB_TYPE IS TABLE OF number INDEX BY BINARY_INTEGER;
      v_tab_PK       PK_TAB_TYPE;
      v_empty_tab_PK PK_TAB_TYPE;
    begin
      for v_rec in (select * from table_B) loop
        v_tab_PK := v_empty_tab_PK;  /* clearing the array */
        update table_A
        set    KEY = v_rec.KEY_NEW
        where (KEY = v_rec.KEY_OLD)
        returning PK bulk collect into v_tab_PK;
        if (v_tab_PK.count > 0) then
          for i in v_tab_PK.first..v_tab_PK.last loop
            insert into TMP_TAB_LOG(PK, KEY_OLD, KEY_NEW)
              values (v_tab_PK(i), v_rec.KEY_OLD, v_rec.KEY_NEW);
          end loop;
        end if;
      end loop;
    end;Because the table B can have up to 500.000 entries (and the table A has even more entries) this solution will cause many update-statements.
    So I am looking for a solution which has better performance.
    My second approach was using an correlated update and looks like this:
    declare
      TYPE PK_TAB_TYPE IS TABLE OF number INDEX BY BINARY_INTEGER;
      v_tab_PK            PK_TAB_TYPE;
      v_empty_tab_PK PK_TAB_TYPE;
      v_tab_NewKey    PK_TAB_TYPE;
    begin
      v_tab_PK         := v_empty_tab_PK;  /* clear the arrays */
      v_tab_NewKey := v_empty_tab_PK;
      update table_A a
      set    KEY = (select KEY_NEW from table_B where (KEY_OLD = a.KEY))
      where exists (select 'x' as OK
                         from   table_B
                         where (KEY_OLD = a.KEY)
      returning PK, KEY bulk collect into v_tab_PK, v_tab_NewKey;
      if (v_tab_PK.count > 0) then
        for i in v_tab_PK.first..v_tab_PK.last loop
          insert into TMP_TAB_LOG_DUB(PK, KEY_OLD, KEY_NEW)
            values (v_tab_PK(i), null, v_tab_NewKey(i));
        end loop;
      end if;
    end;Now I have only one update statement.
    The only thing missing in this second approach is the old KEY before the update in the log table.
    But I have no idea how to get the old value.
    Is there a possibility to modify this second approach to get the old value of the KEY before the update to write it in the log-table?
    And now I need your help:
    What is the best way to get a performant solution for my task?
    Every help appreciated.
    Regards Hartmut

    Below is a script you can run in another testing schema to do the update with logging..... I have created the tables (A and B) with primary key constraints defined...
    create table table_a(pk number primary key
    , key number);
    create table table_b(key_old number primary key
    , key_new number);
    create table TMP_TAB_LOG_DUB(pk number primary key
    , key_old number
    , key_new number);
    ---------insert test data
    insert into table_a values(1,2);
    insert into table_a values(2,2);
    insert into table_a values(3,2);
    insert into table_a values(11,1);
    insert into table_a values(12,1);
    insert into table_a values(13,1);
    insert into table_a values(21,4);
    insert into table_a values(22,4);
    insert into table_a values(23,4);
    commit;
    insert into table_b values(1,3);
    insert into table_b values(4,2);
    commit;
    ----- insert to log
    insert into TMP_TAB_LOG_DUB(PK, KEY_OLD, KEY_NEW)
    select a.pk
    , a.key as key_old
    , b.key_new as key_new
    from table_a a
    join table_b b on a.key = b.key_old;
    ----- update table_a
    update(select a.pk
    , a.key as key_old
    , b.key_new as key_new
    from table_a a
    join table_b b on a.key = b.key_old)
    set key_old = key_new;
    commit;

  • Need help understanding how to resolve this XMLP Report Definition error

    Getting error on only 1 database but is of course is the one for an important deal. Going to Reporting Tools>XML Publisher>Report Definition and querying for Report Name HRS_INT_LET we get errors.
    File associated with template definition is not found in the database. (235,77)
    File object associated with template defintiion is not found in the database, therefore the report and/or template definition is not valid.  Please check consistency of objects.
    Next error message:
    Error in PeopleCode ScrollSelect processing. (2,213) PSXPRPTDEFN_WRK.FUNCLIB.FieldFormula  Name:LoadTemplateDefn  PCPC:37323  Statement:542
    Called from:PSXPRPTDEFN_WRK.FUNCLIB.FieldFormula  Name:LoadReportDefn  Statement:601
    Called from:PSXPRPTDEFN_WRK.FUNCLIB.FieldFormula  Name:SelectReportDefn  Statement:740
    Called from:PSXPRPTDEFN.GBL.PostBuild  Statement:36
    A SQL error occurred during processing of the PeopleCode ScrollSelect (or ScrollSelectNew, RowScrollSelect, RowScrollSelectNew) built-in function.
    This error may have been described by a preceding message.
    Examine the error messages and the PeopleCode program containing the ScrollSelect call to determine the cause of the error.
    Edited by: user702257 on Feb 3, 2010 8:24 AM

    Hey did anyone reply or have a similar problem.. ??
    but with 3 Error Messages, the first one is:
    1st Error:
    SQL error.stmt#:651 Error Position:2010 Return:904 - ORA-00904: "CUSTMERNAME":invalid identifier
    2nd Error:
    SELECT T1, T2, ETC........
    3rd Error:
    Error in PeopleCode ScrollSelect processing. (2,213) At INV.TRANS.FieldChange trans_qry PCPC:1719 Statement: 67
    A SQL error ocurred during processing of the PeopleCode ScrollSelect (or ScrollSelectNew, RowScrollSelect, RowScrollSelectNow) built-in function.
    This error may have been described by preceding message.
    Examine the error message and the PeopleCode program containing the ScrollSelect call to determine the cause of the error.
    does any one know or had this error in particular?
    Thanks
    George

  • How to tune this select

    Hi all,
    Can anyone suggests me how to speed up the following query? What index should I create?
    The Query
    SELECT *
    FROM SCHEDULE_EMP
    WHERE EMP_NO = :b2
    AND :b1 BETWEEN START_DATE AND END_DATE
    Table Structure
    EMP_NO NOT NULL VARCHAR2(10)
    START_DATE NOT NULL DATE
    END_DATE DATE
    SAT NUMBER(2)
    SUN NUMBER(2)
    MON NUMBER(2)
    TUE NUMBER(2)
    WED NUMBER(2)
    THU NUMBER(2)
    FRI NUMBER(2)
    Thanks in advance.

    Hello
    It really helps with this kind of task if you can post the execution plan, and also list what existing indexes you have on the table, volumes of data etc.
    In this case though, with the limited information I would suggest creating an index on emp_no and start_date. Is there a reason why end_date doesn't have a not null constraint? If nulls are valid in end_date, I would have thought you could need to modify the where clause to take that into account. Unfortunately I don't have a database to test on at the mo but I would think you would need to do something like:
    SELECT
    FROM
         SCHEDULE_EMP
    WHERE
         EMP_NO = :b2
    AND
         start_date <= :b1
    AND
         end_date >= :b1
    AND
         end_date IS NOT NULL
    ...or this one if you want to consider nulls in end_date.....
    SELECT
    FROM
         SCHEDULE_EMP
    WHERE
         EMP_NO = :b2
    AND
                   start_date <= :b1
              AND
                   end_date >= :b1
              AND
                   end_date IS NOT NULL
         OR
                   start_date <= :b1
              AND
                   end_date IS NULL
         )If you only want to consider rows with a value in end_date, including it in the index may well prove to be a good move but you would need to try it out.
    HTH
    David

  • How to tune this

    HI all
    This is my query when i run this query its take to much of time to complete and it takes CPU load if 96%
    This is my query
    SELECT order_number, cust_po_number, line_id, order_line_upi,
    order_item_number
    FROM (SELECT oh.order_number order_number,
    oh.cust_po_number cust_po_number,
    ol.line_id line_id, ol.attribute2 order_line_upi,
    ol.attribute20 order_item_number
    FROM hz_org_contacts hzoc,
    hz_relationships hzr,
    hz_cust_account_roles hzcr,
    oe_order_headers_all oh,
    oe_order_lines_all ol,
    mtl_system_items_b msi
    --,hr_operating_units hou
    hr_all_organization_units hou
    WHERE hzoc.attribute1 = p_client_cust_ref
    AND hzoc.party_relationship_id = hzr.relationship_id
    AND hzr.relationship_code = 'CONTACT_OF'
    AND hzr.subject_type = 'PERSON'
    AND hzr.party_id = hzcr.party_id
    AND hzcr.cust_account_role_id = oh.sold_to_contact_id
    AND oh.header_id = ol.header_id
    AND oh.sold_to_org_id = hzcr.cust_account_id
    AND msi.segment1 LIKE '%' || p_product || '%'
    AND msi.inventory_item_id = ol.inventory_item_id
    AND msi.organization_id = ol.ship_from_org_id
              AND ol.attribute2 is not null
    AND oh.org_id = ol.org_id
    AND hou.organization_id = oh.org_id
    AND hou.NAME = g_operating_unit
    ORDER BY oh.creation_date DESC);
    Thanks & Regards
    Srikkanth.M

    You need to give us more information.
    Please read this thread to discover what else you should post:
    HOW TO: Post a SQL statement tuning request - template posting

  • How to tune this SQL Query?

    Hi all expert out there,
    I am using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options.
    I have this ERP 11i query took 3-4hours to execute. can anyone help to have a look at the Query so make it more faster? I am already out of my idea of solving this. Kindly helpzzz...
    SELECT
    /*+ first_rows(1)*/
    hou.name "OU" ,-- e.g. Seagate Technology USOP1 ,
    mc.description,
    oel.ordered_item "Product Part Number",
    oeh.order_number "Order Num",
    hp.party_name "Bill To Cust Name",
    hcsu.location "Ship To Cust Num",
    oel.line_number || '.' || oel.shipment_number "Order Line Num",
    ft.nls_territory "Ship To Country",
    mc.segment7 "designapplication",
    ccm.formattedcapacity||'GB' "Capacity",
    oel.attribute1 "Order Category",
    oel.Subinventory "Subinventory",
    to_char(oel.actual_shipment_date,'MM/DD/YYYY DY') "Shipment Date",
    NVL(oel.shipped_quantity,0) "Net Units"
    FROM
    oe_order_headers_all oeh
    ,oe_order_lines_all oel
    ,apps.hz_parties hp
    ,apps.hz_cust_accounts hca
    ,apps.hz_cust_site_uses_all hcsu
    ,apps.hz_cust_acct_sites_all hcas
    , apps.seaeng_ccfamilymodelinfo ccm
    ,apps.hz_party_sites hps
    ,apps.fnd_territories ft
    ,apps.hz_locations hl
    ,apps.hr_organization_units hou
    ,apps.mtl_parameters mp
    ,apps.mtl_item_categories mic
    ,apps.mtl_categories_b mc
    ,apps.fnd_lookup_values flv
    WHERE
    oeh.header_id = oel.header_id
    AND oel.flow_status_code = 'CLOSED'
    AND oeh.invoice_to_org_id = hcsu.site_use_id
    AND hl.country = ft.territory_code
    AND hps.location_id = hl.location_id
    AND hcas.party_site_id = hps.party_site_id
    AND hcsu.cust_acct_site_id = hcas.cust_acct_site_id
    AND hcas.cust_account_id = hca.cust_account_id
    AND hca.party_id = hp.party_id
    AND oeh.org_id = hou.organization_id
    AND oel.ship_from_org_id = mp.organization_id
    AND oel.inventory_item_id = mic.inventory_item_id
    AND mic.category_id = mc.category_id
    AND mic.category_set_id = 4
    AND mc.description = ccm.stmodelnumber
    AND flv.lookup_code = hca.sales_channel_code
    AND flv.lookup_type = 'SALES_CHANNEL'
    AND mc.segment7 IN ('PSG','ESG','NSG')
    AND flv.lookup_code NOT IN ('RTL','AD-RTL','EU')
    AND oel.attribute1 IN ('NB','NBEOL','NBSEA')
    AND oel.subinventory IN ('KFGI','AFGI','SFGIF','FGIF')
    AND hou.organization_id = 189
    AND trunc(oel.actual_shipment_date) between TO_DATE('01-Jan-2009','DD-MON-YYYY') and TO_DATE('31-JAN-2009','DD-MON-YYYY')
    regards,
    Lygine
    Edited by: user8989062 on Jun 7, 2010 6:39 PM

    5) The TKPROF output for this statement looks like the following:
    SELECT
    /*+ first_rows(1)*/
    hou.name "OU" ,-- e.g. Seagate Technology USOP1 ,
    mc.description,
    oel.ordered_item "Product Part Number",
    oeh.order_number "Order Num",
      hp.party_name  "Bill To Cust Name",
    hcsu.location "Ship To Cust Num",
    oel.line_number || '.' || oel.shipment_number "Order Line Num",
    ft.nls_territory  "Ship To Country",
    mc.segment7 "designapplication",
    ccm.formattedcapacity||'GB' "Capacity",
    oel.attribute1 "Order Category",
    oel.Subinventory "Subinventory",
    to_char(oel.actual_shipment_date,'MM/DD/YYYY DY') "Shipment Date",
    NVL(oel.shipped_quantity,0) "Net Units"
    FROM
          oe_order_headers_all oeh
         ,oe_order_lines_all   oel
         ,apps.hz_parties  hp
         ,apps.hz_cust_accounts  hca
         ,apps.hz_cust_site_uses_all   hcsu
         ,apps.hz_cust_acct_sites_all  hcas
        , apps.seaeng_ccfamilymodelinfo ccm
         ,apps.hz_party_sites hps
         ,apps.fnd_territories ft
         ,apps.hz_locations hl
         ,apps.hr_organization_units  hou
         ,apps.mtl_parameters  mp
         ,apps.mtl_item_categories mic
         ,apps.mtl_categories_b mc
         ,apps.fnd_lookup_values flv
    WHERE
               oeh.header_id = oel.header_id
    AND   oel.flow_status_code = 'CLOSED'
    AND   oeh.invoice_to_org_id = hcsu.site_use_id
    AND   hl.country = ft.territory_code
    AND   hps.location_id = hl.location_id
    AND   hcas.party_site_id = hps.party_site_id
    AND   hcsu.cust_acct_site_id = hcas.cust_acct_site_id
    AND   hcas.cust_account_id = hca.cust_account_id
    AND   hca.party_id   = hp.party_id
    AND   oeh.org_id = hou.organization_id
    AND   oel.ship_from_org_id = mp.organization_id
    AND   oel.inventory_item_id = mic.inventory_item_id
    AND   mic.category_id = mc.category_id
    AND   mic.category_set_id = 4
    AND   mc.description = ccm.stmodelnumber
    AND   flv.lookup_code = hca.sales_channel_code
    AND   flv.lookup_type = 'SALES_CHANNEL'
    AND mc.segment7 IN ('PSG','ESG','NSG')
    AND flv.lookup_code NOT IN ('RTL','AD-RTL','EU')
    AND oel.attribute1 IN ('NB','NBEOL','NBSEA')
    AND oel.subinventory IN ('KFGI','AFGI','SFGIF','FGIF')
    AND hou.organization_id = 189
    AND trunc(oel.actual_shipment_date) between TO_DATE('01-Jan-2009','DD-MON-YYYY') and TO_DATE('31-JAN-2009','DD-MON-YYYY')
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.79       0.79          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        7     22.23     240.85      19781     536082          0         592
    total        9     23.02     241.64      19781     536082          0         592
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 173 
    Rows     Row Source Operation
        592  NESTED LOOPS  (cr=536082 pr=19781 pw=0 time=240822989 us)
        592   NESTED LOOPS  (cr=534885 pr=19776 pw=0 time=239960969 us)
        592    NESTED LOOPS  (cr=533688 pr=19776 pw=0 time=239902332 us)
        594     NESTED LOOPS  (cr=532493 pr=19776 pw=0 time=239811721 us)
        594      NESTED LOOPS  (cr=531892 pr=19776 pw=0 time=239794703 us)
        594       NESTED LOOPS  (cr=530693 pr=19772 pw=0 time=239325284 us)
        594        NESTED LOOPS  (cr=529498 pr=19770 pw=0 time=239152940 us)
        594         NESTED LOOPS  (cr=527709 pr=19766 pw=0 time=236850676 us)
        594          NESTED LOOPS  (cr=525920 pr=19764 pw=0 time=235640068 us)
       2990           NESTED LOOPS  (cr=516943 pr=19688 pw=0 time=195144282 us)
       2990            NESTED LOOPS  (cr=516936 pr=19688 pw=0 time=195120297 us)
       2990             NESTED LOOPS  (cr=510806 pr=19682 pw=0 time=194678671 us)
       3000              HASH JOIN  (cr=504799 pr=19669 pw=0 time=193829763 us)
       3000               NESTED LOOPS  (cr=472280 pr=360 pw=0 time=49218087 us)
          1                NESTED LOOPS  (cr=1029 pr=34 pw=0 time=1745829 us)
          1                 TABLE ACCESS BY INDEX ROWID HR_ALL_ORGANIZATION_UNITS_TL (cr=424 pr=25 pw=0 time=1361442 us)
          1                  INDEX UNIQUE SCAN HR_ALL_ORGANIZATION_UNTS_TL_PK (cr=423 pr=25 pw=0 time=1361397 us)(object id 44637)
          1                 TABLE ACCESS BY INDEX ROWID HR_ALL_ORGANIZATION_UNITS (cr=605 pr=9 pw=0 time=384370 us)
          1                  INDEX UNIQUE SCAN HR_ORGANIZATION_UNITS_PK (cr=1 pr=0 pw=0 time=27 us)(object id 43498)
       3000                TABLE ACCESS BY INDEX ROWID OE_ORDER_LINES_ALL (cr=471251 pr=326 pw=0 time=47466249 us)
    156922                 INDEX RANGE SCAN OE_ORDER_LINES_N20 (cr=420 pr=7 pw=0 time=787919 us)(object id 37005064)
    263469               TABLE ACCESS FULL MTL_ITEM_CATEGORIES (cr=32519 pr=19309 pw=0 time=144242743 us)
       2990              TABLE ACCESS BY INDEX ROWID MTL_CATEGORIES_B (cr=6007 pr=13 pw=0 time=843569 us)
       3000               INDEX UNIQUE SCAN MTL_CATEGORIES_B_U1 (cr=3007 pr=2 pw=0 time=162636 us)(object id 37199)
       2990             TABLE ACCESS BY INDEX ROWID SEAENG_CCFAMILYMODELINFO (cr=6130 pr=6 pw=0 time=437784 us)
       2990              INDEX UNIQUE SCAN SEAENG_CCFAMILYMODELINFO_U1 (cr=2997 pr=0 pw=0 time=52872 us)(object id 35838918)
       2990            INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=7 pr=0 pw=0 time=16332 us)(object id 37657)
        594           TABLE ACCESS BY INDEX ROWID OE_ORDER_HEADERS_ALL (cr=8977 pr=76 pw=0 time=40491633 us)
       2990            INDEX UNIQUE SCAN OE_ORDER_HEADERS_U1 (cr=5987 pr=45 pw=0 time=2504442 us)(object id 41952)
        594          TABLE ACCESS BY INDEX ROWID HZ_CUST_SITE_USES_ALL (cr=1789 pr=2 pw=0 time=1208576 us)
        594           INDEX UNIQUE SCAN HZ_CUST_SITE_USES_U1 (cr=1195 pr=1 pw=0 time=105934 us)(object id 25124976)
        594         TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCT_SITES_ALL (cr=1789 pr=4 pw=0 time=2300224 us)
        594          INDEX UNIQUE SCAN HZ_CUST_ACCT_SITES_U1 (cr=1195 pr=2 pw=0 time=152238 us)(object id 25124996)
        594        TABLE ACCESS BY INDEX ROWID HZ_PARTY_SITES (cr=1195 pr=2 pw=0 time=170875 us)
        594         INDEX UNIQUE SCAN HZ_PARTY_SITES_U1 (cr=601 pr=1 pw=0 time=104550 us)(object id 25124993)
        594       TABLE ACCESS BY INDEX ROWID HZ_LOCATIONS (cr=1199 pr=4 pw=0 time=467329 us)
        594        INDEX UNIQUE SCAN HZ_LOCATIONS_U1 (cr=601 pr=0 pw=0 time=57749 us)(object id 25124992)
        594      TABLE ACCESS BY INDEX ROWID FND_TERRITORIES (cr=601 pr=0 pw=0 time=15562 us)
        594       INDEX UNIQUE SCAN FND_TERRITORIES_U1 (cr=7 pr=0 pw=0 time=6492 us)(object id 33083)
        592     TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCOUNTS (cr=1195 pr=0 pw=0 time=88925 us)
        594      INDEX UNIQUE SCAN HZ_CUST_ACCOUNTS_U1 (cr=601 pr=0 pw=0 time=27607 us)(object id 81600)
        592    INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=1197 pr=0 pw=0 time=56714 us)(object id 32878)
        592   TABLE ACCESS BY INDEX ROWID HZ_PARTIES (cr=1197 pr=5 pw=0 time=860140 us)
        592    INDEX UNIQUE SCAN HZ_PARTIES_U1 (cr=599 pr=0 pw=0 time=51136 us)(object id 25126074)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       7        0.00          0.00
      row cache lock                                  1        0.00          0.00
      gc current block 2-way                      24112        0.00         19.28
      gc cr grant 2-way                             406        0.00          0.19
      db file sequential read                       441        0.09         14.11
      gc cr block 2-way                             284        0.00          0.23
      gc cr block busy                              147        0.19          9.59
      gc current block congested                      2        0.00          0.00
      gc cr multi block request                   13079        0.00          3.98
      SQL*Net message from client                     7        0.27          1.87
      gc cr failure                                  39        0.00          0.02
      cr request retry                               39        0.98         38.27
      SQL*Net more data to client                    12        0.00          0.00
      db file scattered read                       2446        0.13        132.58
      gc cr disk read                                 5        0.00          0.00
    ********************************************************************************6) The DBMS_XPLAN.DISPLAY_CURSOR output:
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  b8pfhfxscqn1m, child number 0
    SELECT  /*+ gather_plan_statistics */  hou.name "OU" ,-- e.g. Seagate Technology USOP1 ,  mc.descript
    oeh.order_number "Order Num",   hp.party_name  "Bill To Cust Name",  hcsu.location "Ship To Cust Num",
    Num",  ft.nls_territory  "Ship To Country",  mc.segment7 "designapplication",  ccm.formattedcapacity
    oel.Subinventory "Subinventory",  to_char(oel.actual_shipment_date,'MM/DD/YYYY DY') "Shipment Date",
    oe_order_headers_all oeh      ,oe_order_lines_all   oel      ,apps.hz_parties  hp      ,apps.hz_cust
    ,apps.hz_cust_acct_sites_all  hcas     , apps.seaeng_ccfamilymodelinfo ccm      ,apps.hz_party_sites hps
        ,apps.hr_organization_units  hou      ,apps.mtl_paramete
    Plan hash value: 414863479
    | Id  | Operation                                  | Name                           | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |  O
    |   1 |  NESTED LOOPS                              |                                |      1 |      1 |    592 |00:02:25.13 |     535K|  57267 |       |
    |   2 |   NESTED LOOPS                             |                                |      1 |      1 |    592 |00:02:24.22 |     533K|  57185 |      
    |   3 |    NESTED LOOPS                            |                                |      1 |      1 |    592 |00:02:24.15 |     532K|  57183 |     
    |   4 |     NESTED LOOPS                           |                                |      1 |      1 |    594 |00:02:24.00 |     531K|  57171 |     
    |   5 |      NESTED LOOPS                          |                                |      1 |      1 |    594 |00:02:23.98 |     530K|  57170 |    
    |   6 |       NESTED LOOPS                         |                                |      1 |      1 |    594 |00:02:23.49 |     529K|  57129 |   
    |   7 |        NESTED LOOPS                        |                                |      1 |      1 |    594 |00:02:23.08 |     528K|  57096 |  
    |   8 |         NESTED LOOPS                       |                                |      1 |      1 |    594 |00:02:22.51 |     526K|  57031 |       |
    |   9 |          NESTED LOOPS                      |                                |      1 |      1 |    594 |00:02:21.79 |     524K|  56968 |       |
    |  10 |           NESTED LOOPS                     |                                |      1 |      1 |   2990 |00:02:09.65 |     515K|  55703 |      
    |  11 |            NESTED LOOPS                    |                                |      1 |      1 |   2990 |00:02:09.62 |     515K|  55703 |     
    |  12 |             NESTED LOOPS                   |                                |      1 |      1 |   2990 |00:02:08.47 |     509K|  55599 |     
    |* 13 |              HASH JOIN                     |                                |      1 |      2 |   3000 |00:02:07.88 |     503K|  55516 |   974K
    |  14 |               NESTED LOOPS                 |                                |      1 |      2 |   3000 |00:01:39.07 |     471K|  23025 |   
    |  15 |                NESTED LOOPS                |                                |      1 |      1 |      1 |00:00:00.01 |       4 |      0 |  
    |  16 |                 TABLE ACCESS BY INDEX ROWID| HR_ALL_ORGANIZATION_UNITS_TL   |      1 |      1 |      1 |00:00
    |* 17 |                  INDEX UNIQUE SCAN         | HR_ALL_ORGANIZATION_UNTS_TL_PK |      1 |      1 |      1 |00:00:00.0
    |* 18 |                 TABLE ACCESS BY INDEX ROWID| HR_ALL_ORGANIZATION_UNITS      |      1 |      1 |      1 |00:00:
    |* 19 |                  INDEX UNIQUE SCAN         | HR_ORGANIZATION_UNITS_PK       |      1 |      1 |      1 |00:00:00.01
    |* 20 |                TABLE ACCESS BY INDEX ROWID | OE_ORDER_LINES_ALL             |      1 |      2 |   3000 |00:01
    |* 21 |                 INDEX RANGE SCAN           | OE_ORDER_LINES_N20             |      1 |  47575 |    156K|00:00:01.76 |     420
    |* 22 |               TABLE ACCESS FULL            | MTL_ITEM_CATEGORIES            |      1 |  96977 |    263K|00:00:28.49
    |* 23 |              TABLE ACCESS BY INDEX ROWID   | MTL_CATEGORIES_B               |   3000 |      1 |   2990 |00:00:0
    |* 24 |               INDEX UNIQUE SCAN            | MTL_CATEGORIES_B_U1            |   3000 |      1 |   3000 |00:00:00.21
    |  25 |             TABLE ACCESS BY INDEX ROWID    | SEAENG_CCFAMILYMODELINFO       |   2990 |      1 |   2990 |
    |* 26 |              INDEX UNIQUE SCAN             | SEAENG_CCFAMILYMODELINFO_U1    |   2990 |      1 |   2990 |00:00:
    |* 27 |            INDEX UNIQUE SCAN               | MTL_PARAMETERS_U1              |   2990 |      1 |   2990 |00:00:00.02 |    
    |* 28 |           TABLE ACCESS BY INDEX ROWID      | OE_ORDER_HEADERS_ALL           |   2990 |      1 |    594 |00:00:
    |* 29 |            INDEX UNIQUE SCAN               | OE_ORDER_HEADERS_U1            |   2990 |      1 |   2990 |00:00:04.29 |   
    |  30 |          TABLE ACCESS BY INDEX ROWID       | HZ_CUST_SITE_USES_ALL          |    594 |      1 |    594 |00:00:
    |* 31 |           INDEX UNIQUE SCAN                | HZ_CUST_SITE_USES_U1           |    594 |      1 |    594 |00:00:00.31 |   
    |  32 |         TABLE ACCESS BY INDEX ROWID        | HZ_CUST_ACCT_SITES_ALL         |    594 |      1 |    594 |00:00:
    |* 33 |          INDEX UNIQUE SCAN                 | HZ_CUST_ACCT_SITES_U1          |    594 |      1 |    594 |00:00:00.23 |   
    |  34 |        TABLE ACCESS BY INDEX ROWID         | HZ_PARTY_SITES                 |    594 |      1 |    594 |00:00:0
    |* 35 |         INDEX UNIQUE SCAN                  | HZ_PARTY_SITES_U1              |    594 |      1 |    594 |00:00:00.17 |     601
    |  36 |       TABLE ACCESS BY INDEX ROWID          | HZ_LOCATIONS                   |    594 |      1 |    594 |00:00:00.4
    |* 37 |        INDEX UNIQUE SCAN                   | HZ_LOCATIONS_U1                |    594 |      1 |    594 |00:00:00.17 |   
    |  38 |      TABLE ACCESS BY INDEX ROWID           | FND_TERRITORIES                |    594 |      1 |    594 |00:00:00
    |* 39 |       INDEX UNIQUE SCAN                    | FND_TERRITORIES_U1             |    594 |      1 |    594 |00:00:00.02
    |* 40 |     TABLE ACCESS BY INDEX ROWID            | HZ_CUST_ACCOUNTS               |    594 |      1 |    592 |00:00:0
    |* 41 |      INDEX UNIQUE SCAN                     | HZ_CUST_ACCOUNTS_U1            |    594 |      1 |    594 |00:00:00.04 |
    |* 42 |    INDEX RANGE SCAN                        | FND_LOOKUP_VALUES_U1           |    592 |      1 |    592 |00:00:00.06 |   
    |  43 |   TABLE ACCESS BY INDEX ROWID              | HZ_PARTIES                     |    592 |      1 |    592 |00:00:00.91 |  
    |* 44 |    INDEX UNIQUE SCAN                       | HZ_PARTIES_U1                  |    592 |      1 |    592 |00:00:00.40 |     599
    Predicate Information (identified by operation id):
      13 - access("OEL"."INVENTORY_ITEM_ID"="MIC"."INVENTORY_ITEM_ID")
      17 - access("HAOTL"."ORGANIZATION_ID"=189 AND "HAOTL"."LANGUAGE"=USERENV('LANG'))
           filter(DECODE("HR_SECURITY"."VIEW_ALL"(),'Y','TRUE',"HR_SECURITY"."SHOW_RECORD"('HR_ALL_ORGAN
      18 - filter("HAO"."BUSINESS_GROUP_ID"=DECODE("HR_GENERAL"."GET_XBG_PROFILE"(),'Y',"HAO"."BUSINESS_
      19 - access("HAO"."ORGANIZATION_ID"=189)
      20 - filter(("OEL"."FLOW_STATUS_CODE"='CLOSED' AND INTERNAL_FUNCTION("OEL"."ATTRIBUTE1") AND INTER
      21 - access("OEL"."SYS_NC00342$">=TO_DATE(' 2009-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "O
                  'syyyy-mm-dd hh24:mi:ss'))
      22 - filter("MIC"."CATEGORY_SET_ID"=4)
      23 - filter(("MC"."DESCRIPTION" IS NOT NULL AND INTERNAL_FUNCTION("MC"."SEGMENT7")))
      24 - access("MIC"."CATEGORY_ID"="MC"."CATEGORY_ID")
      26 - access("MC"."DESCRIPTION"="CCM"."STMODELNUMBER")
      27 - access("OEL"."SHIP_FROM_ORG_ID"="MP"."ORGANIZATION_ID")
      28 - filter("OEH"."ORG_ID"=189)
      29 - access("OEH"."HEADER_ID"="OEL"."HEADER_ID")
      31 - access("OEH"."INVOICE_TO_ORG_ID"="HCSU"."SITE_USE_ID")
      33 - access("HCSU"."CUST_ACCT_SITE_ID"="HCAS"."CUST_ACCT_SITE_ID")
      35 - access("HCAS"."PARTY_SITE_ID"="HPS"."PARTY_SITE_ID")
      37 - access("HPS"."LOCATION_ID"="HL"."LOCATION_ID")
      39 - access("HL"."COUNTRY"="FT"."TERRITORY_CODE")
      40 - filter(("HCA"."SALES_CHANNEL_CODE"<>'RTL' AND "HCA"."SALES_CHANNEL_CODE"<>'AD-RTL' AND "HCA".
      41 - access("HCAS"."CUST_ACCOUNT_ID"="HCA"."CUST_ACCOUNT_ID")
      42 - access("FLV"."LOOKUP_TYPE"='SALES_CHANNEL' AND "FLV"."LOOKUP_CODE"="HCA"."SALES_CHANNEL_CODE"
           filter(("FLV"."LOOKUP_CODE"<>'RTL' AND "FLV"."LOOKUP_CODE"<>'AD-RTL' AND "FLV"."LOOKUP_CODE"<
      44 - access("HCA"."PARTY_ID"="HP"."PARTY_ID")
    90 rows selected.
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &nbs

Maybe you are looking for

  • Facing Problem in SAP PM

    Dear SAP PM Gurus, I am new user in SAP PM facing problem in T_Code IW21 for the field "Person Responsible" can't find  where the customisation to be done for possible entries for this field. Thank You in Advance. Regards Rajesh Pagar 9890413929.

  • BT Billing wrong amounts due to charging for wrong...

    Hello All. This my first post. Sad to say it is a complaint. I will try and be as brief as possible. In March of 2009 I decided to migrate to BT for Broad Band. I already had line and calls from them. I decided on a package deal as follows. "Package

  • Including images in JAR for Swing Application

    I am using a couple of images in a Swing application. When I create the JAR file I include all the images. The JAR executes fine but the images are missing. When I put the images in the same directory as the JAR file the images are properly displayed

  • Debugging source code in Web-Inf

    Dear All Java Expert, I'm using Forte 3.0 and debugging source code for different web application folder. example ..\webapps\APPS1 and ..\webapps\APP2. Ok, my problem is i was unable to 'share and debug' same servlet file over 2 web application. Exam

  • Problem with S2 IS

    Hi, the problem is that I cannot see an image through either the view finder or on the LCD screen. I have changed the batteries and also used a new SD card. Nothing shows up on the FAQ's about this problem! any one?