Help with Performance tunning PL/SQL

Hi All,
I have a PL/SQL procedure, it works fine. No errors, and no bugs. However its taking forever to finish. I am using the concatenation operator (||), and I know its expensive. How can I improve performance to the procedure ?
Here is the code
create or replace
PROCEDURE POST_ADDRESS_CLEANSE AS
CURSOR C1 IS
SELECT Z.ROW_ID,
        Z.NAME
FROM  STGDATA.ACCOUNT_SOURCE Z;
CURSOR  C2 IS
SELECT  DISTINCT CLEANSED_NAME || CLEANSED_STREET_ADDRESS ||
        CLEANSED_STREET_ADDRESS_2 || CLEANSED_CITY || CLEANSED_STATE ||
        CLEANSED_POSTAL_CODE AS FULLRECORD
FROM    STGDATA.ACCOUNT_SOURCE_CLEANSED;
V_ROWID Number := 1;
V_FLAG VARCHAR2(30);
TEMP_ROW_ID VARCHAR2(10) := NULL;
BEGIN
  -- This loop will update CLEANSED_NAME column in ACCOUNT_SOURCE_CLEANSED table.
  FOR X IN C1 LOOP
    TEMP_ROW_ID := TO_CHAR(X.ROW_ID);
  UPDATE STGDATA.ACCOUNT_SOURCE_CLEANSED A
  SET  A.CLEANSED_NAME = X.NAME
  WHERE A.ROW_ID = TEMP_ROW_ID;
    COMMIT;
  END LOOP;
  -- This loop will update columns EM_PRIMARY_FLAG, EM_GROUP_ID in ACCOUNT_SOURCE_CLEANSED table
  FOR Y IN C2 LOOP
    UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
    SET     EM_GROUP_ID = V_ROWID
    WHERE   CLEANSED_NAME || CLEANSED_STREET_ADDRESS || CLEANSED_STREET_ADDRESS_2 ||
            CLEANSED_CITY || CLEANSED_STATE || CLEANSED_POSTAL_CODE = Y.FULLRECORD;
    UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
    SET     EM_PRIMARY_FLAG = 'Y'
    WHERE   CLEANSED_NAME || CLEANSED_STREET_ADDRESS || CLEANSED_STREET_ADDRESS_2 ||
            CLEANSED_CITY || CLEANSED_STATE || CLEANSED_POSTAL_CODE = Y.FULLRECORD
    AND     ROWNUM = 1;
    V_ROWID := V_ROWID + 1;
    COMMIT;
  END LOOP;
  UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
  SET     EM_PRIMARY_FLAG = 'N'
  WHERE   EM_PRIMARY_FLAG IS NULL;
  COMMIT;
  --dbms_output.put_line('V_ROW:'||V_ROWID);
  --dbms_output.put_line('CLEANSED_NAME:'||Y.FULLRECORD); 
END POST_ADDRESS_CLEANSE;
Thanks in advance.
Message was edited by: Rooney -- added code using syntax highlight

I was able to modify my code a bit, however I don't see a way of not using loops.
In the loop, I am updating 2 columns. EM_PRIMARY_FLAG, and EM_GROUP_ID. The data I am working with has duplicate records, and that is why I am using a distinct in the cursor. The requirements are is to make one record a primary record, and the rest are reference records. What makes my record primary is updating column EM_PRIMARY_FLAG with a 'Y', and updating EM_GROUP_ID with a number combines all duplicate records into a group.
In the procedure, I am getting the distinct records, looping through each one, and then doing 2 updates:
1 - Update EM_PRIMARY_FLAG to 'Y' where rownum = 1, this will set one record to be primary
2 - Update EM_GROUP_ID to a number (V_ROWID := V_ROWID + 1) where V_ROWID starts from 1, to group all records into a set.
Here is my latest code after modifying it:
create or replace
PROCEDURE POST_ADDRESS_CLEANSE AS
CURSOR  C1 IS
SELECT      DISTINCT NVL(CLEANSED_NAME, '') AS NAME_CLEANSED,
                  NVL(CLEANSED_STREET_ADDRESS, '') AS ADDRESS_CLEANSED,
                  NVL(CLEANSED_STREET_ADDRESS_2, '') AS ADDRESS2_CLEANSED,
                  NVL(CLEANSED_CITY, '') AS CITY_CLEANSED,
                  NVL(CLEANSED_STATE, '') AS STATE_CLEANSED,
                  NVL(CLEANSED_POSTAL_CODE, '') AS POSTAL_CODE_CLEANSED
FROM        STGDATA.ACCOUNT_SOURCE_CLEANSED;
V_ROWID Number := 1;
V_FLAG VARCHAR2(30);
TEMP_ROW_ID VARCHAR2(10) := NULL;
BEGIN
    UPDATE STGDATA.ACCOUNT_SOURCE_CLEANSED A
    SET  A.CLEANSED_NAME = (SELECT   Z.NAME
                                                   FROM     STGDATA.ACCOUNT_SOURCE Z
                                                   WHERE    Z.ROW_ID = (SELECT  TO_NUMBER(B.ROW_ID)
                                                                                       FROM    STGDATA.ACCOUNT_SOURCE_CLEANSED B
                                                                                       WHERE   B.ROW_ID = A.ROW_ID));
    COMMIT;
  -- This loop will update columns EM_PRIMARY_FLAG, EM_GROUP_ID in ACCOUNT_SOURCE_CLEANSED table
  FOR Y IN C1 LOOP
    UPDATE   STGDATA.ACCOUNT_SOURCE_CLEANSED
    SET          EM_GROUP_ID = V_ROWID
    WHERE    CLEANSED_NAME = Y.NAME_CLEANSED
    AND          CLEANSED_STREET_ADDRESS = Y.ADDRESS_CLEANSED
    AND          CLEANSED_STREET_ADDRESS_2 = Y.ADDRESS2_CLEANSED
    AND          CLEANSED_CITY = Y.CITY_CLEANSED
    AND          CLEANSED_STATE = Y.STATE_CLEANSED
    AND          CLEANSED_POSTAL_CODE = Y.POSTAL_CODE_CLEANSED;
    UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
    SET     EM_PRIMARY_FLAG = 'Y'
    WHERE   CLEANSED_NAME = Y.NAME_CLEANSED
    AND     CLEANSED_STREET_ADDRESS = Y.ADDRESS_CLEANSED
    AND     CLEANSED_STREET_ADDRESS_2 = Y.ADDRESS2_CLEANSED
    AND     CLEANSED_CITY = Y.CITY_CLEANSED
    AND     CLEANSED_STATE = Y.STATE_CLEANSED
    AND     CLEANSED_POSTAL_CODE = Y.POSTAL_CODE_CLEANSED
    AND     ROWNUM = 1;
    V_ROWID := V_ROWID + 1;
  END LOOP;
  COMMIT;
  UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
  SET     EM_PRIMARY_FLAG = 'N'
  WHERE   EM_PRIMARY_FLAG IS NULL;
  COMMIT;
END POST_ADDRESS_CLEANSE;
Thanks
Message was edited by: Rooney - Just added the code in SQL block using syntax highlight.

Similar Messages

  • Need help for performance tunning

    Hello,
    I have 16K records return by query, it takes long time to proceed for 7K it takes 7.5 sec.
    Note: I used all seeded tables only.
    If possible please help me to tune it.
    SELECT       msi.inventory_item_id,msi.segment1,msi.rimary_uom_code , msi.primary_unit_of_measure
    FROM  mtl_system_items_b msi, qp_list_lines qpll,qp_pricing_attributes qppr,
              mtl_category_sets_tl mcs,mtl_category_sets_b mcsb,
              mtl_categories_b mc, mtl_item_categories mcb
    WHERE     msi.enabled_flag = 'Y'
         AND qpll.list_line_id = qppr.list_line_id
         AND qppr.product_attr_value = TO_CHAR (msi.inventory_item_id(+))
         AND qppr.product_uom_code = msi.primary_uom_code
         AND mc.category_id = mcb.category_id
         AND msi.inventory_item_id = mcb.inventory_item_id
         AND msi.organization_id = mcb.organization_id
         AND TRUNC (SYSDATE) BETWEEN NVL (qpll.start_date_active,TRUNC (SYSDATE)) AND NVL (qpll.end_date_active,TRUNC (SYSDATE))
         AND mcs.category_set_name = 'LSS SALES CATEGORY'
         AND mcs.language = 'US'
         AND mcs.category_set_id = mcsb.category_set_id
         AND mcsb.structure_id = mc.structure_id
         AND msi.organization_id = :p_organization_id
         AND qpll.list_header_id = :p_price_list_id
         AND mcb.category_id = :p_category_id;
    Thanks and regards
    Akil.

    Thanks Helios ,
    here is answers
    Databse version
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit  
    PL/SQL Release 11.1.0.7.0
    explain plan
    | Id  | Operation                       | Name                     | Rows  | Bytes | Cost (%CPU)|

    0 | SELECT STATEMENT              
    |                          |   
    1 |   149 |  9439 
    (1)|

    1 |  NESTED LOOPS                   |                          |     1 | 
    149 |  9439   (1)|
    |*
    2 |   HASH JOIN OUTER               |                          |     1 | 
    135 |  9437   (1)|
    |*
    3 |    HASH JOIN                    |                          |     1 |  
    71 |  9432   (1)|

    4 |     NESTED LOOPS                |                          |     2 |  
    76 |    53   (0)|
    |*
    5 |      TABLE ACCESS BY INDEX
    ROWID| QP_LIST_LINES            |     2 |  
    44 |    49   (0)|
    |*
    6 |       INDEX SKIP SCAN           | QP_LIST_LINES_N2         | 
    702 |       |    20 
    (0)|
    |*
    7 |      INDEX RANGE SCAN           | QP_PRICING_ATTRIBUTES_N3 |     1 |  
    16 |     2   (0)|
    |*
    8 |     TABLE ACCESS BY INDEX
    ROWID | MTL_SYSTEM_ITEMS_B       | 46254
    |  1490K|
    9378   (1)|
    |*
    9 |      INDEX RANGE SCAN           | MTL_SYSTEM_ITEMS_B_N9    | 46254 |       | 
    174   (1)|
    |
    10 |    TABLE ACCESS FULL            | XX_WEB_ITEM_IMAGE_TBL    | 
    277 | 17728 |     5   (0)|
    |* 11 |   INDEX RANGE SCAN              | MTL_ITEM_CATEGORIES_U1   |   
    1 |    14 |     2 
    (0)|
    Predicate Information (identified
    by operation id):
    2 -
    access("XWIIT"."IMAGE_CODE"(+)="MSI"."SEGMENT1")
    3 -
    access("QPPR"."PRODUCT_ATTR_VALUE"=TO_CHAR("MSI"."INVENTORY_ITEM_ID")
    AND
    "QPPR"."PRODUCT_UOM_CODE"="MSI"."PRIMARY_UOM_CODE")
    5 - filter(NVL("QPLL"."START_DATE_ACTIVE",TRUNC(SYSDATE@!))<=TRUNC(SYSDATE@!)
    AND
    NVL("QPLL"."END_DATE_ACTIVE",TRUNC(SYSDATE@!))>=TRUNC(SYSDATE@!))
    6 -
    access("QPLL"."LIST_HEADER_ID"=TO_NUMBER(:P_PRICE_LIST_ID))
    filter("QPLL"."LIST_HEADER_ID"=TO_NUMBER(:P_PRICE_LIST_ID))
    7 -
    access("QPLL"."LIST_LINE_ID"="QPPR"."LIST_LINE_ID")
    filter("QPPR"."PRODUCT_UOM_CODE" IS NOT NULL)
    8 - filter("MSI"."ENABLED_FLAG"='Y')
    9 - access("MSI"."ORGANIZATION_ID"=TO_NUMBER(:P_ORGANIZATION_ID))
    11 -
    access("MCB"."ORGANIZATION_ID"=TO_NUMBER(:P_ORGANIZATION_ID)
    AND
    "MSI"."INVENTORY_ITEM_ID"="MCB"."INVENTORY_ITEM_ID"
    AND
    "MCB"."CATEGORY_ID"=TO_NUMBER(:P_CATEGORY_ID))
           filter("MCB"."CATEGORY_ID"=TO_NUMBER(:P_CATEGORY_ID))
    Note
    - 'PLAN_TABLE' is old version
    TKprof Plan
    TKPROF: Release 11.1.0.7.0 - Production on Fri Nov 15 06:12:26 2013
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: LSSD_ora_19760.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    SELECT msi.inventory_item_id,
           msi.segment1,
           primary_uom_code,
           primary_unit_of_measure,
           xwiit.image_url
      FROM mtl_system_items_b msi,
           qp_list_lines qpll,
           qp_pricing_attributes qppr,
           mtl_item_categories mcb,
           xx_web_item_image_tbl xwiit
    WHERE     msi.enabled_flag = 'Y'
           AND qpll.list_line_id = qppr.list_line_id
           AND qppr.product_attr_value = TO_CHAR (msi.inventory_item_id)
           AND qppr.product_uom_code = msi.primary_uom_code
           AND msi.inventory_item_id = mcb.inventory_item_id
           AND msi.organization_id = mcb.organization_id
           AND TRUNC (SYSDATE) BETWEEN NVL (qpll.start_date_active,
                                            TRUNC (SYSDATE))
                                   AND NVL (qpll.end_date_active,
                                            TRUNC (SYSDATE))
           AND xwiit.image_code(+) = msi.segment1
           AND msi.organization_id = :p_organization_id
           AND qpll.list_header_id = :p_price_list_id
           AND mcb.category_id = :p_category_id
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        2      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.00          0          0          0           0
    Fetch        2      3.84       3.85          0     432560          0        1002
    total        6      3.84       3.85          0     432560          0        1002
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 
    Rows     Row Source Operation
        501  NESTED LOOPS  (cr=216280 pr=0 pw=0 time=115 us cost=9439 size=149 card=1)
       2616   HASH JOIN OUTER (cr=211012 pr=0 pw=0 time=39 us cost=9437 size=135 card=1)
      78568    HASH JOIN  (cr=210997 pr=0 pw=0 time=3786 us cost=9432 size=71 card=1)
      78571     NESTED LOOPS  (cr=29229 pr=0 pw=0 time=35533 us cost=53 size=76 card=2)
      78571      TABLE ACCESS BY INDEX ROWID QP_LIST_LINES (cr=9943 pr=0 pw=0 time=27533 us cost=49 size=44 card=2)
    226733       INDEX SKIP SCAN QP_LIST_LINES_N2 (cr=865 pr=0 pw=0 time=4122 us cost=20 size=0 card=702)(object id 99730)
      78571      INDEX RANGE SCAN QP_PRICING_ATTRIBUTES_N3 (cr=19286 pr=0 pw=0 time=0 us cost=2 size=16 card=1)(object id 99733)
    128857     TABLE ACCESS BY INDEX ROWID MTL_SYSTEM_ITEMS_B (cr=181768 pr=0 pw=0 time=9580 us cost=9378 size=1526382 card=46254)
    128857      INDEX RANGE SCAN MTL_SYSTEM_ITEMS_B_N9 (cr=450 pr=0 pw=0 time=1657 us cost=174 size=0 card=46254)(object id 199728)
        277    TABLE ACCESS FULL XX_WEB_ITEM_IMAGE_TBL (cr=15 pr=0 pw=0 time=22 us cost=5 size=17728 card=277)
        501   INDEX RANGE SCAN MTL_ITEM_CATEGORIES_U1 (cr=5268 pr=0 pw=0 time=0 us cost=2 size=14 card=1)(object id 99557)
    Note: I modified query and it gives good result, now it takes 3 to 4 sec for 16000 records.
    If possible can you plz explain what we have to take care while doing performance tunning
    I am a fresher so don't have that much idea.
    and also Thanks Hussein for your replay

  • Need help with performance & memory tuning in a data warehousing environment

    Dear All,
    Good Day.
    We had successfully migrated from a 4 node half-rack V2 Exadata to a 2 node quarter rack X4-2 Exadata. However, we are facing some issues with performance only for few loads while others have in fact shown good improvement.
    1. The total memory on the OS is 250GB for each node (two compute nodes for a quarter rack).
    2. Would be grateful if someone could help me with the best equation to calculate the SGA and PGA ( and also in allocation of shared_pool, large_pool etc) or whether Automatic Memory Management is advisable?
    3. We had run exachk report which suggested us to configure huge pages.
    4. When we tried to increase the SGA to more than 30GB the system doesn't allow us to do so. We had however set the PGA to 85GB.
    5. Also, we had observed that some of the queries involving joins and indexes are taking longer time.
    Any advise would be greatly appreciated.
    Warm Regards,
    Vikram.

    Hi Vikram,
    There is no formula about SGA and PGA, but the best practices for OLTP environments is for a give ammount of memory (which cannot be up to 80% of total RAM from server) you should make 80% to SGA and 20% to PGA. For Data Warehouse envs, the values are like 60% SGA and 40% PGA or it can be up to 50%-50%. Also, some docs disencourage you to keep the database in Automatic Memory Management when you are using a big SGA (> 10G).
    As you are using a RAC environment, you should configure Huge Pages. And if the systems are not allowing you to increase memory, just take a look at the semaphore parameters, probably they are set lower values. And for the poor performance queries, we need to see explain plans, table structure and you would also analyze if smart scan is playing the game.
    Regards.

  • Help with "ORA-06511: PL/SQL: cursor already open"

    I've tried numerous variations on this piece of code and I always get the same result. I'm sure this is painfully obvious to an experienced PL/SQL person.
    Any help will be appreciated!
    Thank You!
    1 DECLARE
    2 CURSOR EMP_CURSOR IS SELECT last_name from employees;
    3 current_last_name varchar2(25);
    4 BEGIN
    5 IF EMP_CURSOR%ISOPEN
    6 THEN
    7 dbms_output.put_line ('cursor is already open');
    8 close EMP_CURSOR;
    9 END IF;
    10 dbms_output.put_line ('opening cursor');
    11 OPEN EMP_CURSOR;
    12 FOR item in EMP_CURSOR LOOP
    13 FETCH EMP_CURSOR INTO current_last_name;
    14 EXIT WHEN EMP_CURSOR%NOTFOUND;
    15 dbms_output.put_line (item.last_name);
    16 END LOOP;
    17 CLOSE EMP_CURSOR;
    18* END;
    19 /
    DECLARE
    ERROR at line 1:
    ORA-06511: PL/SQL: cursor already open
    ORA-06512: at line 2
    ORA-06512: at line 12

    Mathieu,
    Log in as anotherSchema and grant select on 'IDsTable' to the current user.
    SQL> r
      1  create or replace function f1(theID varchar2) return mytype pipelined is
      2  out varchar2(30);
      3  cursor myCursor (x varchar2) is select * from scott.emp where job=x;
      4  begin
      5  for rec in myCursor(theID) loop
      6  pipe row(rec.ename);
      7  end loop;
      8  return;
      9* end;
    Warning: Function created with compilation errors.
    SQL> show errors
    Errors for FUNCTION F1:
    LINE/COL ERROR
    3/33     PL/SQL: SQL Statement ignored
    3/53     PL/SQL: ORA-00942: table or view does not exist
    6/1      PL/SQL: Statement ignored
    6/10     PLS-00364: loop index variable 'REC' use is invalid
    SQL> connect scott
    Enter password: *****
    Connected.
    SQL> grant select on emp to testuser;
    Grant succeeded.
    SQL> connect testuser
    Enter password: ****
    Connected.
    SQL> create or replace function f1(theID varchar2) return mytype pipelined is
      2  out varchar2(30);
      3  cursor myCursor (x varchar2) is select * from scott.emp where job=x;
      4  begin
      5  for rec in myCursor(theID) loop
      6  pipe row(rec.ename);
      7  end loop;
      8  return;
      9  end;
    10  /
    Function created.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Production
    SQL>

  • Help with performance SQL  tuning - Rewriting the query

    Hi
    I have serious performance issues with some 8 update queries
    These were earlier taking 5 mins . Now taking 2.5 hours
    This is one of the culprit UPDATE statement (These are 7 such other update statements on different tables but same logic)
    We have change the update to MERGE and used PARALLEL hints but have not got desired results
    There are appropriate indexes on the tables
    Is there a way to rewrite the UPDATE statement in a better way to improve the performance
    update TABLE_dob
    set key_act =
    (select skey from table_subs
    where sub_act = sub_num)
    where exists
    (select 1 from table_subs
    where sub_act = sub_num);
    Table_DOB has 37 million records
    Table_subs has 20 million records

    aashoo_5 wrote:
    Hi
    I have serious performance issues with some 8 update queries
    These were earlier taking 5 mins . Now taking 2.5 hours
    This is one of the culprit UPDATE statement (These are 7 such other update statements on different tables but same logic)
    We have change the update to MERGE and used PARALLEL hints but have not got desired results
    There are appropriate indexes on the tables
    Is there a way to rewrite the UPDATE statement in a better way to improve the performance
    update TABLE_dob
    set key_act =
    (select skey from table_subs
    where sub_act = sub_num)
    where exists
    (select 1 from table_subs
    where sub_act = sub_num);
    Table_DOB has 37 million records
    Table_subs has 20 million recordsThread: HOW TO: Post a SQL statement tuning request - template posting
    HOW TO: Post a SQL statement tuning request - template posting

  • Help in Performance Tunning

    Hi,
    I am looking for some help in tuning a query and details are below.
    SELECT NVL(B.START_DATE_TIME,
               A.START_DATE_TIME) START_DATE,
           NVL(B.CUST_PRODUCTION_SEQ_NUM,
               A.CUST_PRODUCTION_SEQ_NUM) PROD_NUM,
           A.HEADER_ID NEW_HEADER_ID,
           B.HEADER_ID OLD_HEADER_ID,
           A.LINE_ID,
           B.LINE_ID,
           A.QTY_TYPE_CODE NEW_CODE,
           B.QTY_TYPE_CODE OLD_CODE,
           NVL(B.SHIP_FROM_ORG_ID,
               A.SHIP_FROM_ORG_ID) SHIP_FROM_ORG_ID,
           -- hrorg.name ship_from_name ,
           NVL(B.SHIP_TO_ORG_ID,
               A.SHIP_TO_ORG_ID) SHIP_TO_ORG_ID,
           NVL(B.BILL_TO_ADDRESS_ID,
               A.BILL_TO_ADDRESS_ID) BILL_TO_ADDRESS_ID,
           NVL(B.SHIP_TO_ADDRESS_ID,
               A.SHIP_TO_ADDRESS_ID) SHIP_TO_ADDRESS_ID,
           NVL(B.SHIP_TO_NAME_EXT,
               A.SHIP_TO_NAME_EXT) SHIP_TO_NAME,
           NVL(B.INTRMD_SHIP_TO_ID,
               A.INTRMD_SHIP_TO_ID) INTRMD_SHIP_TO_ID,
           NVL(B.CUSTOMER_ITEM_ID,
               A.CUSTOMER_ITEM_ID) CUSTOMER_ITEM_ID,
           --mci.customer_item_desc customer_item_desc,
           NVL(B.INVENTORY_ITEM_ID,
               A.INVENTORY_ITEM_ID) INVENTORY_ITEM_ID,
           NVL(B.ITEM_DETAIL_SUBTYPE,
               A.ITEM_DETAIL_SUBTYPE) ITEM_DETAIL_SUBTYPE,
           FND1.MEANING DETAIL_SUBTYPE,
           NVL(B.UOM_CODE,
               A.UOM_CODE) UOM_CODE,
           NVL(B.CUST_PO_NUMBER,
               A.CUST_PO_NUMBER) CUST_PO_NUMBER,
           NVL(B.INDUSTRY_ATTRIBUTE1,
               A.INDUSTRY_ATTRIBUTE1) CUST_RECORD_YEAR,
           A.ITEM_DETAIL_QUANTITY,
           A.ITEM_DETAIL_TYPE,
           FND2.MEANING NEW_DETAIL_TYPE,
           B.ITEM_DETAIL_QUANTITY,
           B.ITEM_DETAIL_TYPE,
           FND3.MEANING OLD_DETAIL_TYPE
      FROM RLM_SCHEDULE_LINES_ALL A,
           (SELECT * FROM RLM_SCHEDULE_LINES_ALL b_in
            WHERE TRUNC(b_in.START_DATE_TIME) >=
                  (SELECT TRUNC(SCHED_HORIZON_START_DATE)
                     FROM RLM_SCHEDULE_HEADERS
                    WHERE HEADER_ID = :P_NEW_HEADER_ID)---
            AND TRUNC(b_in.START_DATE_TIME) <=
                  (SELECT TRUNC(SCHED_HORIZON_END_DATE)
                     FROM RLM_SCHEDULE_HEADERS
                    WHERE HEADER_ID = :P_NEW_HEADER_ID)
            AND HEADER_ID = (SELECT header_id
            FROM apps.rlm_schedule_headers_all
           WHERE header_id =
                 (SELECT MAX(rsha.header_id)
                    FROM apps.rlm_schedule_headers_all rsha,
                         apps.rlm_schedule_lines_all rsla
                   WHERE rsha.customer_id = :p_customer_id
                     AND rsha.schedule_type = :p_schedule_type
                     AND rsla.inventory_item_id = b_in.inventory_item_id ---
                     AND rsla.org_id = rsha.org_id
                     AND (((rsla.cust_po_number = b_in.cust_po_number)AND
                           EXISTS (SELECT 'x'
                                   FROM FND_LOOKUP_VALUES_VL FLV,
                                        RA_CUSTOMERS         RC
                                   WHERE FLV.LOOKUP_TYPE = 'TEST_RLM_CHECK_CUST'
                                   AND FLV.MEANING = RC.CUSTOMER_NAME
                                   AND RC.CUSTOMER_ID = :P_CUSTOMER_ID))
                                   OR
                                   NOT EXISTS (SELECT 'x'
                                   FROM FND_LOOKUP_VALUES_VL FLV,
                                        RA_CUSTOMERS         RC
                                   WHERE FLV.LOOKUP_TYPE = 'TEST_RLM_CHECK_CUST'
                                   AND FLV.MEANING = RC.CUSTOMER_NAME
                                   AND RC.CUSTOMER_ID = :P_CUSTOMER_ID) )---
                     and rsha.header_id = rsla.header_id
                     and rsla.ship_from_org_id = :p_ship_from_org_id
                     AND rsha.ece_tp_location_code_ext = :p_ece_tp_location_code_ext
                     AND NVL(rsha.header_ref_value_1, '1') =
                         NVL(rsha.header_ref_value_1, '1')
                     AND rsha.header_id NOT IN
                         (SELECT header_id
                            FROM apps.rlm_schedule_headers_all
                           WHERE attribute1 = :p_request_id)))) B,
           --rlm_schedule_headers c,
           -- hr_organization_units hrorg,
           --mtl_customer_items mci,
           FND_LOOKUPS FND1,
           FND_LOOKUPS FND2,
           FND_LOOKUPS FND3
    -- ra_addresses_all radd2,
    -- ra_site_uses_all rsu2
    WHERE A.HEADER_ID(+) = :P_NEW_HEADER_ID
       ----AND B.HEADER_ID = :P_OLD_HEADER_ID
       AND A.CUSTOMER_ITEM_ID(+) = B.CUSTOMER_ITEM_ID
       AND A.SHIP_TO_ORG_ID(+) = B.SHIP_TO_ORG_ID
       AND A.SHIP_FROM_ORG_ID(+) = B.SHIP_FROM_ORG_ID
       AND A.INVENTORY_ITEM_ID(+) = B.INVENTORY_ITEM_ID
       AND NVL(A.INTRMD_SHIP_TO_ID(+),
               NVL(B.INTRMD_SHIP_TO_ID,
                   0)) = NVL(B.INTRMD_SHIP_TO_ID,
                             0)
       AND A.ITEM_DETAIL_SUBTYPE(+) = B.ITEM_DETAIL_SUBTYPE
       AND A.UOM_CODE(+) = B.UOM_CODE
       AND NVL(A.CUST_PO_NUMBER(+),
               NVL(B.CUST_PO_NUMBER,
                   0)) = NVL(B.CUST_PO_NUMBER,
                             0)
       AND A.ITEM_DETAIL_TYPE(+) < :P_ITEM_DETAIL_TYPE
       AND B.ITEM_DETAIL_TYPE < :P_ITEM_DETAIL_TYPE
       AND TRUNC(A.START_DATE_TIME(+)) = TRUNC(B.START_DATE_TIME)
       AND FND1.LOOKUP_CODE = NVL(A.ITEM_DETAIL_SUBTYPE,
                                  B.ITEM_DETAIL_SUBTYPE)
       AND FND1.LOOKUP_TYPE = :P_RLM_DETAIL_SUBTYPE_CODE
       AND NVL(A.ITEM_DETAIL_TYPE,
               '0') = FND2.LOOKUP_CODE
       AND FND2.LOOKUP_TYPE = :P_RLM_DETAIL_TYPE_CODE
       AND FND3.LOOKUP_CODE = B.ITEM_DETAIL_TYPE
       AND A.SHIP_FROM_ORG_ID(+) = :P_SHIP_FROM_ORG_ID
       AND B.SHIP_FROM_ORG_ID = :P_SHIP_FROM_ORG_ID
       AND FND3.LOOKUP_TYPE = :P_RLM_DETAIL_TYPE_CODE
       AND B.CUSTOMER_ITEM_ID IN
           (SELECT DISTINCT CUSTOMER_ITEM_ID
              FROM RLM_SCHEDULE_LINES_ALL
             WHERE HEADER_ID = :P_NEW_HEADER_ID) &P_WHERE4 &P_WHERE3
    -- CHANGES
    &P_WHERE_DATE_A
    UNION
    SELECT NVL(A.START_DATE_TIME,
               B.START_DATE_TIME) START_DATE,
           NVL(A.CUST_PRODUCTION_SEQ_NUM,
               B.CUST_PRODUCTION_SEQ_NUM) PROD_NUM,
           A.HEADER_ID NEW_HEADER_ID,
           B.HEADER_ID OLD_HEADER_ID,
           A.LINE_ID,
           B.LINE_ID,
           A.QTY_TYPE_CODE NEW_CODE,
           B.QTY_TYPE_CODE OLD_CODE,
           NVL(A.SHIP_FROM_ORG_ID,
               B.SHIP_FROM_ORG_ID) SHIP_FROM_ORG_ID,
           -- hrorg.name ship_from_name ,
           NVL(A.SHIP_TO_ORG_ID,
               B.SHIP_TO_ORG_ID) SHIP_TO_ORG_ID,
           NVL(A.BILL_TO_ADDRESS_ID,
               B.BILL_TO_ADDRESS_ID) BILL_TO_ADDRESS_ID,
           NVL(A.SHIP_TO_ADDRESS_ID,
               B.SHIP_TO_ADDRESS_ID) SHIP_TO_ADDRESS_ID,
           NVL(A.SHIP_TO_NAME_EXT,
               B.SHIP_TO_NAME_EXT) SHIP_TO_NAME,
           NVL(A.INTRMD_SHIP_TO_ID,
               B.INTRMD_SHIP_TO_ID) INTRMD_SHIP_TO_ID,
           NVL(A.CUSTOMER_ITEM_ID,
               B.CUSTOMER_ITEM_ID) CUSTOMER_ITEM_ID,
           --mci.customer_item_desc customer_item_desc,
           NVL(A.INVENTORY_ITEM_ID,
               B.INVENTORY_ITEM_ID) INVENTORY_ITEM_ID,
           NVL(A.ITEM_DETAIL_SUBTYPE,
               B.ITEM_DETAIL_SUBTYPE) ITEM_DETAIL_SUBTYPE,
           FND1.MEANING DETAIL_SUBTYPE,
           NVL(A.UOM_CODE,
               B.UOM_CODE) UOM_CODE,
           NVL(A.CUST_PO_NUMBER,
               B.CUST_PO_NUMBER) CUST_PO_NUMBER,
           NVL(A.INDUSTRY_ATTRIBUTE1,
               B.INDUSTRY_ATTRIBUTE1) CUST_RECORD_YEAR,
           A.ITEM_DETAIL_QUANTITY,
           A.ITEM_DETAIL_TYPE,
           FND2.MEANING NEW_DETAIL_TYPE,
           B.ITEM_DETAIL_QUANTITY,
           B.ITEM_DETAIL_TYPE,
           FND3.MEANING OLD_DETAIL_TYPE
      FROM RLM_SCHEDULE_LINES_ALL A,
           (SELECT * FROM RLM_SCHEDULE_LINES_ALL b_in
           WHERE  TRUNC(b_in.START_DATE_TIME) >=
           (SELECT TRUNC(SCHED_HORIZON_START_DATE)
              FROM RLM_SCHEDULE_HEADERS
             WHERE HEADER_ID = :P_NEW_HEADER_ID)
           AND HEADER_ID = (SELECT header_id
            FROM apps.rlm_schedule_headers_all
           WHERE header_id =
                 (SELECT MAX(rsha.header_id)
                    FROM apps.rlm_schedule_headers_all rsha,
                         apps.rlm_schedule_lines_all rsla
                   WHERE rsha.customer_id = :p_customer_id
                     AND rsha.schedule_type = :p_schedule_type
                     AND rsla.inventory_item_id = b_in.inventory_item_id ---
                     AND rsla.org_id = rsha.org_id
                     AND (((rsla.cust_po_number = b_in.cust_po_number)AND
                           EXISTS (SELECT 'x'
                                   FROM FND_LOOKUP_VALUES_VL FLV,
                                        RA_CUSTOMERS         RC
                                   WHERE FLV.LOOKUP_TYPE = 'TEST_RLM_CHECK_CUST'
                                   AND FLV.MEANING = RC.CUSTOMER_NAME
                                   AND RC.CUSTOMER_ID = :P_CUSTOMER_ID))
                                   OR
                                   NOT EXISTS (SELECT 'x'
                                   FROM FND_LOOKUP_VALUES_VL FLV,
                                        RA_CUSTOMERS         RC
                                   WHERE FLV.LOOKUP_TYPE = 'TEST_RLM_CHECK_CUST'
                                   AND FLV.MEANING = RC.CUSTOMER_NAME
                                   AND RC.CUSTOMER_ID = :P_CUSTOMER_ID) )---
                     and rsha.header_id = rsla.header_id
                     and rsla.ship_from_org_id = :p_ship_from_org_id
                     AND rsha.ece_tp_location_code_ext = :p_ece_tp_location_code_ext
                     AND NVL(rsha.header_ref_value_1, '1') =
                         NVL(rsha.header_ref_value_1, '1')
                     AND rsha.header_id NOT IN
                         (SELECT header_id
                            FROM apps.rlm_schedule_headers_all
                           WHERE attribute1 = :p_request_id)))) B,
           --rlm_schedule_headers c,
           -- hr_organization_units hrorg,
           --mtl_customer_items mci,
           FND_LOOKUPS FND1,
           FND_LOOKUPS FND2,
           FND_LOOKUPS FND3
    -- ra_addresses_all radd2,
    -- ra_site_uses_all rsu2
    WHERE A.HEADER_ID = :P_NEW_HEADER_ID
      ---- AND B.HEADER_ID(+) = :P_OLD_HEADER_ID
          --a.header_id=c.header_id and
          -- a.header_id = 803 and
          -- b.header_id (+) = 804 and
       AND B.CUSTOMER_ITEM_ID(+) = A.CUSTOMER_ITEM_ID
       AND B.SHIP_TO_ORG_ID(+) = A.SHIP_TO_ORG_ID
       AND B.SHIP_FROM_ORG_ID(+) = A.SHIP_FROM_ORG_ID
       AND B.INVENTORY_ITEM_ID(+) = A.INVENTORY_ITEM_ID
       AND NVL(B.INTRMD_SHIP_TO_ID(+),
               NVL(A.INTRMD_SHIP_TO_ID,
                   0)) = NVL(A.INTRMD_SHIP_TO_ID,
                             0)
       AND B.ITEM_DETAIL_SUBTYPE(+) = A.ITEM_DETAIL_SUBTYPE
       AND B.UOM_CODE(+) = A.UOM_CODE
       AND NVL(B.CUST_PO_NUMBER(+),
               NVL(A.CUST_PO_NUMBER,
                   0)) = NVL(A.CUST_PO_NUMBER,
                             0)
       AND B.ITEM_DETAIL_TYPE(+) < :P_ITEM_DETAIL_TYPE
       AND A.ITEM_DETAIL_TYPE < :P_ITEM_DETAIL_TYPE
       AND TRUNC(B.START_DATE_TIME(+)) = TRUNC(A.START_DATE_TIME)
       AND FND1.LOOKUP_CODE = NVL(B.ITEM_DETAIL_SUBTYPE,
                                  A.ITEM_DETAIL_SUBTYPE)
       AND FND1.LOOKUP_TYPE = :P_RLM_DETAIL_SUBTYPE_CODE
       AND A.ITEM_DETAIL_TYPE = FND2.LOOKUP_CODE
       AND FND2.LOOKUP_TYPE = :P_RLM_DETAIL_TYPE_CODE
       AND NVL(B.ITEM_DETAIL_TYPE,
               '0') = FND3.LOOKUP_CODE
       AND A.SHIP_FROM_ORG_ID = :P_SHIP_FROM_ORG_ID
       AND B.SHIP_FROM_ORG_ID(+) = :P_SHIP_FROM_ORG_ID
       AND FND3.LOOKUP_TYPE = :P_RLM_DETAIL_TYPE_CODE
       &P_WHERE5 &P_WHERE3
    -- CHANGES
    &P_WHERE_DATE_BThe above query is related to the Oracle Release Management 11.5.10.2
    The main header table is RLM_SCHEDULE_HEADERS_ALL which contains the information like schedule_reference_number and other details. In one schedule there can be many item records for different dates which are stored in the child table RLM_SCHEDULE_LINES_ALL. Both the tables are linked with HEADER_ID. Each schedule in header table has one horizon start date and horizon end date. Customer used to send these schedules every day for each item because of there business needs.
    The requirement is to create a query to calculate the Net Change between the two schedules (Between the new and old). All the item records from child table for new schedule will be printed but only those item records from old schedule will be printed where schedule date in child table is within the horizon start date and end date of new schedule.
    There are following indexes on the table RLM_SCHEDULE_LINES_ALL
    IDX$$_199350001                     Normal     INVENTORY_ITEM_ID, SHIP_TO_ORG_ID, SHIP_FROM_NAME_EXT
    IDX$$_199350002                     Normal     HEADER_ID, INVENTORY_ITEM_ID
    RLM_SCHEDULE_LINE_CUSTOM     Normal     ITEM_DETAIL_TYPE, HEADER_ID
    RLM_SCHEDULE_LINE_N1             Normal     HEADER_ID, INTERFACE_LINE_ID
    RLM_SCHEDULE_LINE_N2             Normal     SHIP_FROM_ORG_ID, SHIP_TO_ORG_ID, CUSTOMER_ITEM_ID
    RLM_SCHEDULE_LINE_N99             Normal     INVENTORY_ITEM_ID
    RLM_SCHEDULE_LINE_U1             Normal     LINE_ID
    XXRLM_RLM_SCHEDULE_LINES     Normal     SHIP_TO_ORG_ID, SHIP_FROM_NAME_EXT, PROCESS_STATUS, ITEM_DETAIL_TYPE, INVENTORY_ITEM_ID, CUSTOMER_ITEM_ID
    Database Version: 11.1.0.7.0Optimizer Parameters:
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    _optimizer_push_pred_cost_based      boolean     TRUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.1.0.6
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     FALSE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL>
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     8
    SQL>
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL>
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL>
    SQL> SELECT SNAME,
      2         PNAME,
      3         PVAL1,
      4         PVAL2
      5    FROM SYS.AUX_STATS$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          03-30-2011 06:20
    SYSSTATS_INFO        DSTOP                           03-30-2011 06:20
    SYSSTATS_INFO        FLAGS                         0
    SYSSTATS_MAIN        CPUSPEEDNW              976.063
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM                       
    SYSSTATS_MAIN        MREADTIM                       
    SYSSTATS_MAIN        CPUSPEED                       
    SYSSTATS_MAIN        MBRC                           
    SYSSTATS_MAIN        MAXTHR                         
    SYSSTATS_MAIN        SLAVETHR                       
    13 rows selected
    SQL>Output of the explain plan will be in the next thread because of size constraint.

    Here is the output of explain plan
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation                                 | Name                     | R
    |   0 | SELECT STATEMENT                          |                          |
    |   1 |  SORT UNIQUE                              |                          |
    |   2 |   UNION-ALL                               |                          |
    |*  3 |    FILTER                                 |                          |
    |   4 |     NESTED LOOPS                          |                          |
    |   5 |      NESTED LOOPS                         |                          |
    |   6 |       NESTED LOOPS                        |                          |
    |*  7 |        HASH JOIN                          |                          |
    |   8 |         TABLE ACCESS BY INDEX ROWID       | RLM_SCHEDULE_LINES_ALL   |
    |*  9 |          INDEX SKIP SCAN                  | RLM_SCHEDULE_LINE_CUSTOM |
    |* 10 |         HASH JOIN RIGHT OUTER             |                          |
    |* 11 |          TABLE ACCESS BY INDEX ROWID      | RLM_SCHEDULE_LINES_ALL   |
    |* 12 |           INDEX SKIP SCAN                 | RLM_SCHEDULE_LINE_CUSTOM |
    |  13 |          NESTED LOOPS                     |                          |
    |  14 |           NESTED LOOPS                    |                          |
    |  15 |            TABLE ACCESS BY INDEX ROWID    | FND_LOOKUP_VALUES        |
    PLAN_TABLE_OUTPUT
    |* 16 |             INDEX RANGE SCAN              | IDX$$_123E00001          |
    |* 17 |            INDEX RANGE SCAN               | RLM_SCHEDULE_LINE_CUSTOM |
    |* 18 |           TABLE ACCESS BY INDEX ROWID     | RLM_SCHEDULE_LINES_ALL   |
    |* 19 |            TABLE ACCESS BY INDEX ROWID    | RLM_SCHEDULE_HEADERS_ALL |
    |* 20 |             INDEX UNIQUE SCAN             | RLM_SCHEDULE_HEADERS_U1  |
    |* 21 |            TABLE ACCESS BY INDEX ROWID    | RLM_SCHEDULE_HEADERS_ALL |
    |* 22 |             INDEX UNIQUE SCAN             | RLM_SCHEDULE_HEADERS_U1  |
    |  23 |        TABLE ACCESS BY INDEX ROWID        | FND_LOOKUP_VALUES        |
    |* 24 |         INDEX RANGE SCAN                  | FND_LOOKUP_VALUES_U1     |
    |* 25 |       INDEX RANGE SCAN                    | FND_LOOKUP_VALUES_U1     |
    |  26 |      TABLE ACCESS BY INDEX ROWID          | FND_LOOKUP_VALUES        |
    |* 27 |     INDEX UNIQUE SCAN                     | RLM_SCHEDULE_HEADERS_U1  |
    |  28 |      SORT AGGREGATE                       |                          |
    |  29 |       NESTED LOOPS                        |                          |
    |  30 |        NESTED LOOPS                       |                          |
    |  31 |         NESTED LOOPS ANTI                 |                          |
    |* 32 |          TABLE ACCESS BY INDEX ROWID      | RLM_SCHEDULE_HEADERS_ALL |
    |* 33 |           INDEX RANGE SCAN                | RLM_SCHEDULE_HEADERS_N3  |
    |* 34 |          TABLE ACCESS BY INDEX ROWID      | RLM_SCHEDULE_HEADERS_ALL |
    |* 35 |           INDEX UNIQUE SCAN               | RLM_SCHEDULE_HEADERS_U1  |
    |* 36 |         INDEX RANGE SCAN                  | IDX$$_199350002          |
    PLAN_TABLE_OUTPUT
    |* 37 |        TABLE ACCESS BY INDEX ROWID        | RLM_SCHEDULE_LINES_ALL   |
    |  38 |         NESTED LOOPS                      |                          |
    |  39 |          NESTED LOOPS                     |                          |
    |  40 |           TABLE ACCESS BY INDEX ROWID     | HZ_CUST_ACCOUNTS         |
    |* 41 |            INDEX UNIQUE SCAN              | HZ_CUST_ACCOUNTS_U1      |
    |  42 |           TABLE ACCESS BY INDEX ROWID     | HZ_PARTIES               | 5
    |* 43 |            INDEX UNIQUE SCAN              | HZ_PARTIES_U1            |
    |* 44 |          INDEX RANGE SCAN                 | FND_LOOKUP_VALUES_U2     |
    |  45 |         NESTED LOOPS                      |                          |
    |  46 |          NESTED LOOPS                     |                          |
    |  47 |           TABLE ACCESS BY INDEX ROWID     | HZ_CUST_ACCOUNTS         |
    |* 48 |            INDEX UNIQUE SCAN              | HZ_CUST_ACCOUNTS_U1      |
    |  49 |           TABLE ACCESS BY INDEX ROWID     | HZ_PARTIES               | 5
    |* 50 |            INDEX UNIQUE SCAN              | HZ_PARTIES_U1            |
    |* 51 |          INDEX RANGE SCAN                 | FND_LOOKUP_VALUES_U2     |
    |  52 |    NESTED LOOPS                           |                          |
    |  53 |     NESTED LOOPS                          |                          |
    |  54 |      NESTED LOOPS                         |                          |
    |  55 |       NESTED LOOPS OUTER                  |                          |
    |  56 |        NESTED LOOPS                       |                          |
    |  57 |         TABLE ACCESS BY INDEX ROWID       | FND_LOOKUP_VALUES        |
    PLAN_TABLE_OUTPUT
    |* 58 |          INDEX RANGE SCAN                 | IDX$$_123E00001          |
    |* 59 |         TABLE ACCESS BY INDEX ROWID       | RLM_SCHEDULE_LINES_ALL   |
    |* 60 |          INDEX RANGE SCAN                 | RLM_SCHEDULE_LINE_CUSTOM |
    |* 61 |        VIEW PUSHED PREDICATE              |                          |
    |* 62 |         FILTER                            |                          |
    |* 63 |          FILTER                           |                          |
    |* 64 |           TABLE ACCESS BY INDEX ROWID     | RLM_SCHEDULE_LINES_ALL   |
    |* 65 |            INDEX RANGE SCAN               | IDX$$_199350001          |
    |* 66 |            TABLE ACCESS BY INDEX ROWID    | RLM_SCHEDULE_HEADERS_ALL |
    |* 67 |             INDEX UNIQUE SCAN             | RLM_SCHEDULE_HEADERS_U1  |
    |* 68 |          INDEX UNIQUE SCAN                | RLM_SCHEDULE_HEADERS_U1  |
    |  69 |           SORT AGGREGATE                  |                          |
    |  70 |            NESTED LOOPS                   |                          |
    |  71 |             NESTED LOOPS                  |                          |
    |  72 |              NESTED LOOPS ANTI            |                          |
    |* 73 |               TABLE ACCESS BY INDEX ROWID | RLM_SCHEDULE_HEADERS_ALL |
    |* 74 |                INDEX RANGE SCAN           | RLM_SCHEDULE_HEADERS_N3  |
    |* 75 |               TABLE ACCESS BY INDEX ROWID | RLM_SCHEDULE_HEADERS_ALL |
    |* 76 |                INDEX UNIQUE SCAN          | RLM_SCHEDULE_HEADERS_U1  |
    |* 77 |              INDEX RANGE SCAN             | IDX$$_199350002          |
    |* 78 |             TABLE ACCESS BY INDEX ROWID   | RLM_SCHEDULE_LINES_ALL   |
    PLAN_TABLE_OUTPUT
    |  79 |              NESTED LOOPS                 |                          |
    |  80 |               NESTED LOOPS                |                          |
    |  81 |                TABLE ACCESS BY INDEX ROWID| HZ_CUST_ACCOUNTS         |
    |* 82 |                 INDEX UNIQUE SCAN         | HZ_CUST_ACCOUNTS_U1      |
    |  83 |                TABLE ACCESS BY INDEX ROWID| HZ_PARTIES               | 5
    |* 84 |                 INDEX UNIQUE SCAN         | HZ_PARTIES_U1            |
    |* 85 |               INDEX RANGE SCAN            | FND_LOOKUP_VALUES_U2     |
    |  86 |              NESTED LOOPS                 |                          |
    |  87 |               NESTED LOOPS                |                          |
    |  88 |                TABLE ACCESS BY INDEX ROWID| HZ_CUST_ACCOUNTS         |
    |* 89 |                 INDEX UNIQUE SCAN         | HZ_CUST_ACCOUNTS_U1      |
    |  90 |                TABLE ACCESS BY INDEX ROWID| HZ_PARTIES               | 5
    |* 91 |                 INDEX UNIQUE SCAN         | HZ_PARTIES_U1            |
    |* 92 |               INDEX RANGE SCAN            | FND_LOOKUP_VALUES_U2     |
    |  93 |       TABLE ACCESS BY INDEX ROWID         | FND_LOOKUP_VALUES        |
    |* 94 |        INDEX RANGE SCAN                   | FND_LOOKUP_VALUES_U1     |
    |* 95 |      INDEX RANGE SCAN                     | FND_LOOKUP_VALUES_U1     |
    |  96 |     TABLE ACCESS BY INDEX ROWID           | FND_LOOKUP_VALUES        |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       3 - filter("HEADER_ID"= (SELECT "HEADER_ID" FROM "APPS"."RLM_SCHEDULE_HEADERS
                  "RLM_SCHEDULE_HEADERS_ALL" WHERE "HEADER_ID"= (SELECT MAX("RSHA"."
                  "APPS"."RLM_SCHEDULE_LINES_ALL" "RSLA","APPS"."RLM_SCHEDULE_HEADER
                  "RSHA","APPS"."RLM_SCHEDULE_HEADERS_ALL" "RLM_SCHEDULE_HEADERS_ALL
                  "RSHA"."HEADER_ID"="HEADER_ID" AND TO_NUMBER("ATTRIBUTE1")=1090072
                  "RSHA"."ECE_TP_LOCATION_CODE_EXT"='AG-60989' AND "RSHA"."CUSTOMER_
                  "RSHA"."SCHEDULE_TYPE"='PLANNING_RELEASE' AND NVL("RSHA"."HEADER_R
                  "RSLA"."INVENTORY_ITEM_ID"=:B1 AND "RSHA"."HEADER_ID"="RSLA"."HEAD
                  "RSLA"."SHIP_FROM_ORG_ID"=2904 AND ("RSLA"."CUST_PO_NUMBER"=:B2 AN
                  "AR"."HZ_CUST_ACCOUNTS" "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APP
                  WHERE "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=US
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742) OR  NOT EXISTS (SELECT 0 FROM
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742)) AND "RSLA"."ORG_ID"="RSHA"."
       7 - access("B_IN"."CUSTOMER_ITEM_ID"="CUSTOMER_ITEM_ID")
       9 - access("HEADER_ID"=1197995)
    PLAN_TABLE_OUTPUT
           filter("HEADER_ID"=1197995)
      10 - access("A"."CUSTOMER_ITEM_ID"(+)="B_IN"."CUSTOMER_ITEM_ID" AND
                  "A"."SHIP_TO_ORG_ID"(+)="B_IN"."SHIP_TO_ORG_ID" AND
                  "A"."SHIP_FROM_ORG_ID"(+)="B_IN"."SHIP_FROM_ORG_ID" AND
                  "A"."INVENTORY_ITEM_ID"(+)="B_IN"."INVENTORY_ITEM_ID" AND
                  "A"."ITEM_DETAIL_SUBTYPE"(+)="B_IN"."ITEM_DETAIL_SUBTYPE" AND "A".
                  AND TRUNC(INTERNAL_FUNCTION("A"."START_DATE_TIME"(+)))=TRUNC(INTER
                  IME")))
           filter(NVL("A"."INTRMD_SHIP_TO_ID"(+),NVL("B_IN"."INTRMD_SHIP_TO_ID",0))=
                  SHIP_TO_ID",0) AND NVL("A"."CUST_PO_NUMBER"(+),NVL("B_IN"."CUST_PO
                  O_NUMBER",'0'))
      11 - filter("A"."SHIP_FROM_ORG_ID"(+)=2904)
      12 - access("A"."HEADER_ID"(+)=1197995)
           filter("A"."HEADER_ID"(+)=1197995 AND TO_NUMBER("A"."ITEM_DETAIL_TYPE"(+)
      16 - access("LOOKUP_TYPE"='RLM_DETAIL_TYPE_CODE' AND "VIEW_APPLICATION_ID"=0 A
                  "LANGUAGE"=USERENV('LANG'))
           filter("SECURITY_GROUP_ID"="FND_GLOBAL"."LOOKUP_SECURITY_GROUP"("LV"."LOO
                  W_APPLICATION_ID"))
      17 - access("LOOKUP_CODE"="B_IN"."ITEM_DETAIL_TYPE")
           filter(TO_NUMBER("B_IN"."ITEM_DETAIL_TYPE")<3)
      18 - filter("B_IN"."SHIP_FROM_ORG_ID"=2904 AND TRUNC(INTERNAL_FUNCTION("B_IN".
    PLAN_TABLE_OUTPUT
                  >= (SELECT TRUNC(INTERNAL_FUNCTION("SCHED_HORIZON_START_DATE")) FR
                  "RLM"."RLM_SCHEDULE_HEADERS_ALL" "RLM_SCHEDULE_HEADERS_ALL" WHERE
                  NVL("ORG_ID",NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1
                  ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99)))=NVL(TO_NUMBE
                  INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99))
                  TRUNC(INTERNAL_FUNCTION("B_IN"."START_DATE_TIME"))<= (SELECT
                  TRUNC(INTERNAL_FUNCTION("SCHED_HORIZON_END_DATE")) FROM "RLM"."RLM
                  "RLM_SCHEDULE_HEADERS_ALL" WHERE "HEADER_ID"=1197995 AND
                  NVL("ORG_ID",NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1
                  ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99)))=NVL(TO_NUMBE
                  INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99))
      19 - filter(NVL("ORG_ID",NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1
                  ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99)))=NVL(TO_NUMBE
                  INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99))
      20 - access("HEADER_ID"=1197995)
      21 - filter(NVL("ORG_ID",NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1
                  ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99)))=NVL(TO_NUMBE
                  INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99))
      22 - access("HEADER_ID"=1197995)
      24 - access("LOOKUP_TYPE"='RLM_DETAIL_SUBTYPE_CODE' AND "VIEW_APPLICATION_ID"=
                  "LOOKUP_CODE"=NVL("A"."ITEM_DETAIL_SUBTYPE","B_IN"."ITEM_DETAIL_SU
    PLAN_TABLE_OUTPUT
                  "LANGUAGE"=USERENV('LANG'))
           filter("LANGUAGE"=USERENV('LANG') AND "SECURITY_GROUP_ID"="FND_GLOBAL"."L
                  P"("LV"."LOOKUP_TYPE","LV"."VIEW_APPLICATION_ID"))
      25 - access("LOOKUP_TYPE"='RLM_DETAIL_TYPE_CODE' AND "VIEW_APPLICATION_ID"=0 A
                  "LOOKUP_CODE"=NVL("A"."ITEM_DETAIL_TYPE",'0') AND "LANGUAGE"=USERE
           filter("LANGUAGE"=USERENV('LANG') AND "SECURITY_GROUP_ID"="FND_GLOBAL"."L
                  P"("LV"."LOOKUP_TYPE","LV"."VIEW_APPLICATION_ID"))
      27 - access("HEADER_ID"= (SELECT MAX("RSHA"."HEADER_ID") FROM "APPS"."RLM_SCHE
                  "RSLA","APPS"."RLM_SCHEDULE_HEADERS_ALL" "RSHA","APPS"."RLM_SCHEDU
                  "RLM_SCHEDULE_HEADERS_ALL" WHERE "RSHA"."HEADER_ID"="HEADER_ID" AN
                  TO_NUMBER("ATTRIBUTE1")=109007290 AND "RSHA"."ECE_TP_LOCATION_CODE
                  "RSHA"."CUSTOMER_ID"=64742 AND "RSHA"."SCHEDULE_TYPE"='PLANNING_RE
                  NVL("RSHA"."HEADER_REF_VALUE_1",'1') IS NOT NULL AND "RSLA"."INVEN
                  "RSHA"."HEADER_ID"="RSLA"."HEADER_ID" AND "RSLA"."SHIP_FROM_ORG_ID
                  ("RSLA"."CUST_PO_NUMBER"=:B2 AND  EXISTS (SELECT 0 FROM "AR"."HZ_C
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742) OR  NOT EXISTS (SELECT 0 FROM
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
    PLAN_TABLE_OUTPUT
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742)) AND "RSLA"."ORG_ID"="RSHA"."
      32 - filter("RSHA"."CUSTOMER_ID"=64742 AND "RSHA"."SCHEDULE_TYPE"='PLANNING_RE
                  NVL("RSHA"."HEADER_REF_VALUE_1",'1') IS NOT NULL)
      33 - access("RSHA"."ECE_TP_LOCATION_CODE_EXT"='AG-60989')
      34 - filter(TO_NUMBER("ATTRIBUTE1")=109007290)
      35 - access("RSHA"."HEADER_ID"="HEADER_ID")
      36 - access("RSHA"."HEADER_ID"="RSLA"."HEADER_ID" AND "RSLA"."INVENTORY_ITEM_I
      37 - filter("RSLA"."SHIP_FROM_ORG_ID"=2904 AND ("RSLA"."CUST_PO_NUMBER"=:B1 AN
                  0 FROM "AR"."HZ_CUST_ACCOUNTS" "CUST_ACCT","AR"."HZ_PARTIES" "PART
                  "B" WHERE "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742) OR  NOT EXISTS (SELECT 0 FROM
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742)) AND "RSLA"."ORG_ID"="RSHA"."
      41 - access("CUST_ACCT"."CUST_ACCOUNT_ID"=64742)
      43 - access("CUST_ACCT"."PARTY_ID"="PARTY"."PARTY_ID")
      44 - access("B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."MEANING"=SUBSTRB("
                  AND "B"."LANGUAGE"=USERENV('LANG'))
    PLAN_TABLE_OUTPUT
           filter("B"."LANGUAGE"=USERENV('LANG') AND "B"."MEANING"=SUBSTRB("PARTY_NA
      48 - access("CUST_ACCT"."CUST_ACCOUNT_ID"=64742)
      50 - access("CUST_ACCT"."PARTY_ID"="PARTY"."PARTY_ID")
      51 - access("B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."MEANING"=SUBSTRB("
                  AND "B"."LANGUAGE"=USERENV('LANG'))
           filter("B"."LANGUAGE"=USERENV('LANG') AND "B"."MEANING"=SUBSTRB("PARTY_NA
      58 - access("LOOKUP_TYPE"='RLM_DETAIL_TYPE_CODE' AND "VIEW_APPLICATION_ID"=0 A
                  "LANGUAGE"=USERENV('LANG'))
           filter("SECURITY_GROUP_ID"="FND_GLOBAL"."LOOKUP_SECURITY_GROUP"("LV"."LOO
                  W_APPLICATION_ID"))
      59 - filter("A"."SHIP_FROM_ORG_ID"=2904)
      60 - access("A"."ITEM_DETAIL_TYPE"="LOOKUP_CODE" AND "A"."HEADER_ID"=1197995)
           filter(TO_NUMBER("A"."ITEM_DETAIL_TYPE")<3)
      61 - filter(NVL("B"."INTRMD_SHIP_TO_ID"(+),NVL("A"."INTRMD_SHIP_TO_ID",0))=NVL
                  O_ID",0) AND "B"."ITEM_DETAIL_SUBTYPE"(+)="A"."ITEM_DETAIL_SUBTYPE
                  "B"."UOM_CODE"(+)="A"."UOM_CODE" AND NVL("B"."CUST_PO_NUMBER"(+),N
                  ("A"."CUST_PO_NUMBER",'0') AND TRUNC(INTERNAL_FUNCTION("B"."START_
                  NCTION("A"."START_DATE_TIME")))
      62 - filter("HEADER_ID"= (SELECT "HEADER_ID" FROM "APPS"."RLM_SCHEDULE_HEADERS
                  "RLM_SCHEDULE_HEADERS_ALL" WHERE "HEADER_ID"= (SELECT MAX("RSHA"."
                  "APPS"."RLM_SCHEDULE_LINES_ALL" "RSLA","APPS"."RLM_SCHEDULE_HEADER
    PLAN_TABLE_OUTPUT
                  "RSHA","APPS"."RLM_SCHEDULE_HEADERS_ALL" "RLM_SCHEDULE_HEADERS_ALL
                  "RSHA"."HEADER_ID"="HEADER_ID" AND TO_NUMBER("ATTRIBUTE1")=1090072
                  "RSHA"."ECE_TP_LOCATION_CODE_EXT"='AG-60989' AND "RSHA"."CUSTOMER_
                  "RSHA"."SCHEDULE_TYPE"='PLANNING_RELEASE' AND NVL("RSHA"."HEADER_R
                  "RSLA"."INVENTORY_ITEM_ID"=:B1 AND "RSHA"."HEADER_ID"="RSLA"."HEAD
                  "RSLA"."SHIP_FROM_ORG_ID"=2904 AND ("RSLA"."CUST_PO_NUMBER"=:B2 AN
                  "AR"."HZ_CUST_ACCOUNTS" "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APP
                  WHERE "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=US
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742) OR  NOT EXISTS (SELECT 0 FROM
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742)) AND "RSLA"."ORG_ID"="RSHA"."
      63 - filter("A"."SHIP_FROM_ORG_ID"=2904)
      64 - filter("B_IN"."CUSTOMER_ITEM_ID"="A"."CUSTOMER_ITEM_ID" AND
                  "B_IN"."SHIP_FROM_ORG_ID"="A"."SHIP_FROM_ORG_ID" AND TO_NUMBER("B_
                  TRUNC(INTERNAL_FUNCTION("B_IN"."START_DATE_TIME"))>= (SELECT
                  TRUNC(INTERNAL_FUNCTION("SCHED_HORIZON_START_DATE")) FROM "RLM"."R
                  "RLM_SCHEDULE_HEADERS_ALL" WHERE "HEADER_ID"=1197995 AND
                  NVL("ORG_ID",NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1
    PLAN_TABLE_OUTPUT
                  ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99)))=NVL(TO_NUMBE
                  INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99))
      65 - access("B_IN"."INVENTORY_ITEM_ID"="A"."INVENTORY_ITEM_ID" AND
                  "B_IN"."SHIP_TO_ORG_ID"="A"."SHIP_TO_ORG_ID")
      66 - filter(NVL("ORG_ID",NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1
                  ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99)))=NVL(TO_NUMBE
                  INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),(-99))
      67 - access("HEADER_ID"=1197995)
      68 - access("HEADER_ID"= (SELECT MAX("RSHA"."HEADER_ID") FROM "APPS"."RLM_SCHE
                  "RSLA","APPS"."RLM_SCHEDULE_HEADERS_ALL" "RSHA","APPS"."RLM_SCHEDU
                  "RLM_SCHEDULE_HEADERS_ALL" WHERE "RSHA"."HEADER_ID"="HEADER_ID" AN
                  TO_NUMBER("ATTRIBUTE1")=109007290 AND "RSHA"."ECE_TP_LOCATION_CODE
                  "RSHA"."CUSTOMER_ID"=64742 AND "RSHA"."SCHEDULE_TYPE"='PLANNING_RE
                  NVL("RSHA"."HEADER_REF_VALUE_1",'1') IS NOT NULL AND "RSLA"."INVEN
                  "RSHA"."HEADER_ID"="RSLA"."HEADER_ID" AND "RSLA"."SHIP_FROM_ORG_ID
                  ("RSLA"."CUST_PO_NUMBER"=:B2 AND  EXISTS (SELECT 0 FROM "AR"."HZ_C
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742) OR  NOT EXISTS (SELECT 0 FROM
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
    PLAN_TABLE_OUTPUT
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742)) AND "RSLA"."ORG_ID"="RSHA"."
      73 - filter("RSHA"."CUSTOMER_ID"=64742 AND "RSHA"."SCHEDULE_TYPE"='PLANNING_RE
                  NVL("RSHA"."HEADER_REF_VALUE_1",'1') IS NOT NULL)
      74 - access("RSHA"."ECE_TP_LOCATION_CODE_EXT"='AG-60989')
      75 - filter(TO_NUMBER("ATTRIBUTE1")=109007290)
      76 - access("RSHA"."HEADER_ID"="HEADER_ID")
      77 - access("RSHA"."HEADER_ID"="RSLA"."HEADER_ID" AND "RSLA"."INVENTORY_ITEM_I
      78 - filter("RSLA"."SHIP_FROM_ORG_ID"=2904 AND ("RSLA"."CUST_PO_NUMBER"=:B1 AN
                  0 FROM "AR"."HZ_CUST_ACCOUNTS" "CUST_ACCT","AR"."HZ_PARTIES" "PART
                  "B" WHERE "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742) OR  NOT EXISTS (SELECT 0 FROM
                  "CUST_ACCT","AR"."HZ_PARTIES" "PARTY","APPLSYS"."FND_LOOKUP_VALUES
                  "B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."LANGUAGE"=USERENV(
                  "B"."MEANING"=SUBSTRB("PARTY_NAME",1,50) AND "CUST_ACCT"."PARTY_ID
                  "CUST_ACCT"."CUST_ACCOUNT_ID"=64742)) AND "RSLA"."ORG_ID"="RSHA"."
      82 - access("CUST_ACCT"."CUST_ACCOUNT_ID"=64742)
      84 - access("CUST_ACCT"."PARTY_ID"="PARTY"."PARTY_ID")
      85 - access("B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."MEANING"=SUBSTRB("
    PLAN_TABLE_OUTPUT
                  AND "B"."LANGUAGE"=USERENV('LANG'))
           filter("B"."LANGUAGE"=USERENV('LANG') AND "B"."MEANING"=SUBSTRB("PARTY_NA
      89 - access("CUST_ACCT"."CUST_ACCOUNT_ID"=64742)
      91 - access("CUST_ACCT"."PARTY_ID"="PARTY"."PARTY_ID")
      92 - access("B"."LOOKUP_TYPE"='ETN_RLM_CHECK_CUST' AND "B"."MEANING"=SUBSTRB("
                  AND "B"."LANGUAGE"=USERENV('LANG'))
           filter("B"."LANGUAGE"=USERENV('LANG') AND "B"."MEANING"=SUBSTRB("PARTY_NA
      94 - access("LOOKUP_TYPE"='RLM_DETAIL_SUBTYPE_CODE' AND "VIEW_APPLICATION_ID"=
                  "LOOKUP_CODE"=NVL("B"."ITEM_DETAIL_SUBTYPE","A"."ITEM_DETAIL_SUBTY
                  "LANGUAGE"=USERENV('LANG'))
           filter("LANGUAGE"=USERENV('LANG') AND "SECURITY_GROUP_ID"="FND_GLOBAL"."L
                  P"("LV"."LOOKUP_TYPE","LV"."VIEW_APPLICATION_ID"))
      95 - access("LOOKUP_TYPE"='RLM_DETAIL_TYPE_CODE' AND "VIEW_APPLICATION_ID"=0 A
                  "LOOKUP_CODE"=NVL("B"."ITEM_DETAIL_TYPE",'0') AND "LANGUAGE"=USERE
           filter("LANGUAGE"=USERENV('LANG') AND "SECURITY_GROUP_ID"="FND_GLOBAL"."L
                  P"("LV"."LOOKUP_TYPE","LV"."VIEW_APPLICATION_ID"))
    Note
       - 'PLAN_TABLE' is old version
    313 rows selectedPlease suggest me how can I work on the query part to improve the performance.
    Thanks
    Vishalaksha

  • I need help with network install of SQL Developer 3.2

    All,
    Does anyone have any references on how to perform a network install for SQL Developer? Here is what I'm trying to achieve:
    1. Network installation on drive S:\ (Windows, obviously)
    2. User links to network installation
    3. Connections are unique for each user
    I found the 2006 posting of network install for Raptor, but I could not find anything that correlates with the latest release. All I have done so far is downloaded and unzipped. Any help/instructions/guides/tutorials are welcome.

    You have installed!.  The code for SQLDeveloper does not have an installer.
    If the software is on S, say a shared drive, each user will start sqldeveloper and a directory called sqldeveloper  will be created in their local %APPLICATION_DATA% folder.  This will keep all connections etc unique for all users. 
    You will have to create a link from the S drive to the sqldeveloper.exe if you want a shortcut to start it.  We dont provide it.
    Thanks
    B

  • Help for performance tunning

    Hi Gurus,
    I m new to the group and SAP BW as well,so i need ur valuable inputs for a Performance related Project.
    I m going to start  a new project in a wks time so and i m working as a Performance Tuning Consultant on that(Load & Query Performance),but i don't have any idea about this,so i need ur valuable advice on that,plz.
    Can anyone plz suggest me the possible ways of suggestions so that i can tell the client as a gud consultant to start with but these days i m going though BW Performance & Authorization(BW360) which is really helpful for me but apart from that i need ur valuable inputs as well.
    Thanks in Advance.
    regards
    Amit

    hi Amit,
    check this.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/afbad390-0201-0010-daa4-9ef0168d41b6
    also
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/media/uuid/10b589ad-0701-0010-0299-e5c282b7aaad
    regards.

  • Need help in performance tunning

    Hi , i have one update statement , where it is keep on running for hours and the volume of the data is 2.2 million
    version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    below is the code :
    DECLARE
    Cursor C11
    Is
    Select Account_Num,Outlet_Num,Product_Number,Ln_Of_Biz,Generateguid('DELIVERED_PRODUCT') As Dp_Guid From (
    Select Account_Num,Outlet_Num,Product_Number,Ln_Of_Biz
    From transformation_flat
    Group By Account_Num, Outlet_Num,Ln_Of_Biz,Product_Number
    Having Count(*)> 1);
    Type Actno Is Table Of Varchar2(13) Index By Binary_Integer;
    Type Outlet Is Table Of NUMBER Index By Binary_Integer;
    Type Pno Is Table Of VARCHAR2(255) INDEX BY BINARY_INTEGER;
    Type Tn Is Table Of VARCHAR2(10) Index By Binary_Integer;
    Type Vdpguid Is Table Of VARCHAR2(20) Index By Binary_Integer;
    Type Vcnt Is Table Of Number Index By Binary_Integer;
    Type Lob1 Is Table Of Varchar2(255) Index By Binary_Integer;
    Type Offer_No Is Table Of Varchar2(255) Index By Binary_Integer;
    V_Actno Actno;
    V_Outlet Outlet;
    V_Pno Pno;
    V_Tn Tn;
    V_DPGUID VDPGUID;
    Vguid Varchar2(20);
    V_Cnt Vcnt;
    V_Lob Lob1;
    V_Offer_No Offer_No;
    BEGIN
    Open c11;
    Loop
    Fetch C11 Bulk Collect Into V_Actno,V_Outlet,V_Pno,V_Lob,V_Dpguid;
    Exit When C11%Notfound;
    End Loop;
    close c11;
    Forall I In 1..V_Actno.count
    Update transformation_flat Set Product_Guid=V_Dpguid(I) Where
    Account_Num=V_Actno(I) And
    Outlet_Num=V_Outlet(I) And
    Product_Number=V_Pno(I) And
    ln_of_biz=v_lob(I);
    Commit;
    END;
    for above i do have index on that table on (account_num,outlet_num,product_number,ln_of_biz).
    when i checked the memory contents for this sqlid in v$sql , below are the values :
    Disk_Read:21640650
    Buffer_Gets:22466856
    Concurrency_Wait_Time:16923
    Cluster_Wait_Time:36313694
    user_io_wait_time:3594365433
    I need some inputs in which area i can tune the above code..
    Thanks

    835589 wrote:
    hi i am also face same performance issue pls reply me ASApDon't use the word ASAP, it is rude and a violation of forum terms and conditions.
    http://www.oracle.com/html/terms.html
    >
    4. Use of Community Services
    Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
    You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle
    >
    These people are for ASAP requests.
    http://www.google.com/search?q=oracle+consultant
    where i need to tune the queery.
    pls i am eagarly waiting for that
    Read and understand the links posted above
    RPuttagunta wrote:
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long ...

  • Help with i Tunes

    I wanted to go on to my i Tunes and add more music. When I try to open i Tunes, I get a message that says: The file "i Tunes Library .itl" cannot be read because it was created by a newer version of i Tunes. HELP!!! I need to be able to add music!

    One way is to download the latest iTunes from Apple and then point the latest version to your i Tunes Library .itl location.
    However there seems to be a lot of syncing and deleted files problems, when using the latest iTunes with the iPod Classic.
    I would prefer to use your current iTunes, if it is not giving any problem with your iPod Classic.
    1. Click the File menu
    2. Select Add Folder to Library
    this will show you where your music files are supposed to be. ( either in iTunes Music or iTunes Media )
    3. Click OK
    and wait for 20 minutes or so while iTunes generate a new library file.
    Good luck.

  • Help with search within pl/sql code

    Hi All,
    Can you please help me to find all the objects with a database link.
    I have some procedures,function and packages which uses database link. I need to fetch all the objects that uses a database link. Is there any way to get the list of object names using any database link?
    Thanks in advance
    Apppreciate your help!
    Thanks
    Bob

    hi there,
    the problem with dba_source is that the code might be wrapped.
    another possibility is to query dba_dependencies, column referenced_link
    Also you can have pl/sql routines that create dynamically code and might use dblinks in their dynamic code.
    So you might not be able to be 100 percent complete.
    HTH Mathias

  • Help with escape option in sql

    SQL> select sname from shares where sname like 'VIS_%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    SQL> select sname from shares where sname like 'VIS\_%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    SQL> select sname from shares where sname like 'VIS_\%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    could u people please help me to get the row with the sname vis_sin only....

    Hi Sybrand - here it is - please point to the error
    if you see it...
    Thanks.
    Connected to:
    Oracle Database 10g Enterprise Edition Release
    10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select table_name from dba_tables where
    table_name like 'PS\_%' and rownum<10 escape '\';
    select table_name from dba_tables where table_name
    like 'PS\_%' and rownum<10 escape '\'
    ERROR at line 1:
    ORA-00933: SQL command not properly endedselect table_name from dba_tables where table_name like 'PS\_%' escape '\' and rownum < 10;
    the 'escape' is part of the like condition so you need it contiguous to the like clause.

  • Help with performance of a subroutine

    Hi Experts,
    can anyone help me tweek the code so that the performance is improved? will appreciate ur response.
    thanks in advance.
    *&      Form  GET_PHY_QUANTITY
          text
         -->P_LT_LAGP  text
         <--P_LS_LAGP  text
         <--P_LT_PHYSICAL  text
    form get_phy_quantity  using    p_lt_aqua type tt_aqua
                                    p_lt_lagp type tt_lagp
                           changing p_ls_aqua type gs_aqua
                                    p_ls_lagp type gs_lagp
                                    p_lt_physical.
      types: begin of ty_hu,
         lgnum_hu    type /scwm/lgnum,
         huident     type /scwm/de_huident,
         guid_hu     type guid,
        end of ty_hu.
      types: begin of ty_ordim,
        lgnum      type /scwm/lgnum,
        lgpla      type /scwm/lgpla,
        guid_stock type /lime/guid_stock,
       end of ty_ordim.
      types: begin of ty_nquan,
          guid_stock  type /lime/guid_stock,
          guid_parent type /lime/guid_parent,
          punit       type /lime/unit,
          pquan       type /lime/quantity,
          coo         type /scwm/de_coo,
          lgpla       type /scwm/lgpla,   "RJ
        end of ty_nquan.
      data: ls_hu    type ty_hu,
            ls_ordim type ty_ordim,
            ls_nquan type ty_nquan,
            lv_tabix type sy-tabix.
      data: lt_guid  type standard table of ty_hu,
            ls_guid  type  ty_hu,
            lt_hu    type standard table of ty_hu,
            lt_ordim like standard table of ls_ordim,
            lt_nquan like standard table of ls_nquan .
      data: ls_data type zspm_binquan.
      data: lt_data type standard table of zspm_binquan.
    lgpla in p_lt_lagp and huident in /scwm/hu_iw01 have different data types.
    So, we are moving the lgpla field to a huident field before selection from the table.
      loop at p_lt_lagp into p_ls_lagp.
        move p_ls_lagp-lgnum to ls_hu-lgnum_hu.
        move p_ls_lagp-lgpla to ls_hu-huident.
        append ls_hu to lt_hu.
        read table p_lt_aqua into p_ls_aqua with key lgnum = p_ls_lagp-lgnum
                                                     lgpla = p_ls_lagp-lgpla
                                                     matid = '00000000000000000000000000000000'.
        if sy-subrc = 0.
    " If AQUA table has blank Product, we have to get it from WT table.
         IF  p_ls_aqua-matid IS INITIAL.
            move p_ls_aqua-guid_stock to ls_ordim-guid_stock.
            move p_ls_aqua-lgnum to ls_ordim-lgnum.
            move p_ls_aqua-lgpla to ls_ordim-lgpla.
            append ls_ordim to lt_ordim.
         ENDIF.
        endif.
      endloop.
      clear: ls_ordim, ls_hu, p_ls_aqua, p_ls_lagp.
      select lgnum_hu huident guid_hu
       from /scwm/hu_iw01
        into table lt_guid
        for all entries in lt_hu
      where lgnum_hu = lt_hu-lgnum_hu and huident = lt_hu-huident.
      if sy-subrc = 0.
        sort lt_guid by guid_hu.
        delete adjacent duplicates from lt_guid comparing all fields.
      endif.
      select n~guid_stock
             n~guid_parent
             n~unit
             n~quan
             q~coo
                into table lt_nquan
               from ( /lime/nquan as n
            left outer join /scwm/quan  as q
              on qguid_stock = nguid_stock
              and qguid_parent = nguid_parent )
            for all entries in lt_guid
              where n~guid_parent = lt_guid-guid_hu
                and n~guid_stock gt '0000000000000000'
                and n~vsi eq space
                and n~quan gt 0.
      sort lt_nquan by guid_parent guid_stock.
       loop at lt_nquan into ls_nquan.    "RJ
         lv_tabix = sy-tabix.
         read table lt_guid into ls_guid with key guid_hu =  ls_nquan-guid_parent.
         if sy-subrc eq 0.
         ls_nquan-lgpla = ls_guid-huident.
         modify lt_nquan from ls_nquan index lv_tabix.
         endif.
       endloop.
      loop at lt_nquan into ls_nquan.
    If there is physical qty but no available quantity, move to lt_ordim table.
        read table p_lt_aqua into p_ls_aqua with key guid_stock  = ls_nquan-guid_stock
                                                           lgpla = ls_nquan-lgpla.
        if sy-subrc ne 0.
          read table lt_guid into ls_hu with key guid_hu = ls_nquan-guid_parent binary search.
          if sy-subrc = 0.
            move ls_hu-lgnum_hu      to ls_ordim-lgnum.
            move ls_hu-huident       to ls_ordim-lgpla.
            move ls_nquan-guid_stock to ls_ordim-guid_stock.
            append ls_ordim to lt_ordim.
          endif.
        endif.
      endloop.
      sort lt_ordim by lgpla guid_stock.
      clear: ls_nquan, ls_ordim.
      loop at lt_nquan into ls_nquan.
        move-corresponding ls_nquan to ls_data.
    If not in AQUA table, get the batch, stock type from WT tables, ORDIM_O or ORDIM_C.
        read table lt_ordim into ls_ordim with key  lgpla = ls_nquan-lgpla
                                                    guid_stock = ls_nquan-guid_stock binary search.
        if sy-subrc = 0.
          select single matid cat charg wdatu
           from /scwm/ordim_o
           into (ls_data-matid, ls_data-cat, ls_data-charg, ls_data-wdatu)
           where lgnum eq ls_ordim-lgnum and guid_stock eq ls_ordim-guid_stock.
          if sy-subrc ne 0.
            select single matid cat charg wdatu
            from /scwm/ordim_c
            into (ls_data-matid, ls_data-cat, ls_data-charg, ls_data-wdatu)
            where lgnum eq ls_ordim-lgnum and guid_stock eq ls_ordim-guid_stock.
          endif.
          ls_data-lgnum   = ls_ordim-lgnum.
          ls_data-huident = ls_ordim-lgpla.
        else. " if there is avail. qty., get batch and other info from AQUA table.
          read table p_lt_aqua into p_ls_aqua with key guid_stock = ls_nquan-guid_stock 
                                                                            lgpla = ls_nquan-lgpla.
          if sy-subrc = 0.
            ls_data-lgnum   = p_ls_aqua-lgnum.
            ls_data-huident = p_ls_aqua-lgpla.
            ls_data-matid   = p_ls_aqua-matid.
            ls_data-cat     = p_ls_aqua-cat.
            ls_data-charg   = p_ls_aqua-charg.
            ls_data-wdatu   = p_ls_aqua-wdatu.
          endif.
        endif.
        append ls_data to lt_data.
      endloop.
      p_lt_physical = lt_data.
      refresh: lt_data, lt_ordim, lt_guid, lt_hu, lt_nquan.
    endform.                    " GET_PHY_QUANTITY

    Hi friends,
    I have a function module which does array insertions and is causing a slowdown can you please recommend any changes ? or any ideas as to what can be done? Thanks in advance.
    Thanks,
    Kathy.
    <code>
    function Zwmsid_ship_id_insert .
    ""Update Function Module:
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(IT_SHIP_ID_HD) TYPE  Z_TT_SID_HD
    *"     VALUE(IT_SHIP_ID_ITM) TYPE  Z_TT_SID_IT
    *"     VALUE(IT_SHIP_ID_PR) TYPE  Z_TT_SID_PR
    *"     VALUE(IT_SHIP_ID_HU) TYPE  Z_TT_SID_HU
    *"     VALUE(IT_SHIP_ID_REFDOC) TYPE  Z_TT_SID_RFD
    *"  EXCEPTIONS
    *"      INSERTION_FAILED
    This is for Inserting Data from the IMPORT parameter Tables into
    the DB tables.
    To avoid run-time dump, ACCEPTING DUPLICATE KEYS addition is used.
    if exception is result, ROLLBACK work is done in the calling module
    Local Data Objects
    Variables
      data: lv_initial_sid type c,
    Work Area
            ls_ship_id_hd type Z_tsid_hd,   " Ship-Id Header
            ls_sid_ht type Z_tsid_ht,       " Ship-ID History
    Internal Tables
            lt_sid_ht type Z_tt_sid_ht.     " Ship-ID History Table
      data: lv_timestamp(15) type c,
            lv_systimstp     type /scdl/dl_cretst,
            lv_tz            type tznzone          value 'UTC'.
    Build the Ship-ID data for building History table
      loop at it_ship_id_hd into ls_ship_id_hd.
        if ls_ship_id_hd-ship_id  is initial.
          lv_initial_sid = gc_x.
        endif.
        ls_sid_ht-ship_id        = ls_ship_id_hd-ship_id  . " Ship-ID
        ls_sid_ht-status         = gc_created             . " CR
        ls_sid_ht-direction      = ls_ship_id_hd-direction. " Direction
        ls_sid_ht-username       = sy-uname               . " User Name
        append ls_sid_ht to lt_sid_ht.
        clear: ls_sid_ht, ls_ship_id_hd.
      endloop.
      if not lv_initial_sid is initial.
        clear: lv_initial_sid.
        message e014 raising insertion_failed.
      endif.
    Inserting Ship-ID Header Data
      insert Z_tsid_hd from table it_ship_id_hd
             accepting duplicate keys.
      if sy-subrc ne 0.
        message e011 raising insertion_failed.
      endif.
    Inserting Ship-ID Item Data
      insert Z_tsid_it from table it_ship_id_itm
             accepting duplicate keys.
      if sy-subrc ne 0.
        message e011 raising insertion_failed.
      endif.
    Inserting Ship-ID Partner Data
      insert Z_tsid_pr from table it_ship_id_pr
             accepting duplicate keys.
      if sy-subrc ne 0.
        message e011 raising insertion_failed.
      endif.
    Inserting Ship-ID HU (handling Unit) Data
      insert Z_tsid_hu from table it_ship_id_hu
             accepting duplicate keys.
      if sy-subrc ne 0.
        message e011 raising insertion_failed.
      endif.
    Inserting Ship-ID Reference Document table Data
      insert Z_tsid_rfd from table it_ship_id_refdoc
             accepting duplicate keys.
      if sy-subrc ne 0.
        message e011 raising insertion_failed.
      endif.
    Inserting into Ship-ID History Table
      insert Z_tsid_ht from table lt_sid_ht
             accepting duplicate keys.
      if sy-subrc ne 0.
        message e011 raising insertion_failed.
      endif.
    endfunction.
    <code>

  • Help with performance issues

    Hi peep, looking for some pointers on performance after installing a fresh copy of 7 starter. Have upgraded RAM to 2Gig but still booting takes 15 mins. Running the machine is incredibly slow. I have an S10-3 model with an intel atom, which i dont expect to be a power house but surely it should be useable. Any help would be great thanks.

    Hello
    I would suggest you start looking at the startrup programs and deselect some of them which you think you may not need during boot times.
    Cheers and regards,
    • » νιנαソѕαяα∂нι ѕαмανє∂αм ™ « •
    ●๋•کáŕádhí'ک díáŕý ツ
    I am a volunteer here. I don't work for Lenovo

  • Help with Performing a Clean Install of Windows 8.1

    Hey. I just bought a laptop today and it came with Windows 8.1. However, my issue is that my OS resides in a huge partition (900+ MB). And I don't want this. I want to re-allocate space, and take a portion from my OS's drive in order to create more partitions.
    However, to do that, I have to format the drive, which I can't 'cause it contains the OS.
    Bottom line: I don't have a CD installer for Windows 8 or Windows 8.1. I am trying to perform a clean install of Windows 8.1 in my laptop. Can I get the installer online? Can I use the product key here in my already activated Windows 8.1 OS? Do I need to
    install Windows 8 before installing Windows 8.1?
     

    you may be able to shrink the existing volume(s):
    https://technet.microsoft.com/en-us/library/cc731894(v=ws.10).aspx
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

Maybe you are looking for

  • Feature Request:  Useful toStrings in Cookie and HttpServletResponse/Reques

    Hi. It seems obvious to me that the Cookie.toString() should give the text representation of the Cookie as it will appear in the HTTP header. The reason that I need this is that Java does NOT support HttpOnly and I need to insert it into the Cookie m

  • Oracle 8.1.7 driver limit causes problems with CMP

    The information below is from Oracle's site and has been noted by a few people on various message groups. We had upgraded to 8.1.7 but hadn't put the latest classes12.zip (June 2001) in our classpath. When we do, we get the following error from the d

  • To extend AirPort Extreme 802.11n

    Wanting to extend the range of my AirPort Extreme 802.11n (version 7.4.2) I have a Airport Express as trial also a 802.11n. AirPort Utility has a lot of trouble finding the Express. When AirPort Utility does find it and I want to set up the Express I

  • Dell 2405FPW 24" display problem. Please help

    Can anyone help me with this, I can't seem to get an answer from either Dell tech support nor from Apple. I just received my dell 2405FPW 24" display. Connected it to DVI port 1 on my powermac G5. It started to work just fine for the first hour or so

  • Mac OS 10.2.8 forgetting my HP Printer

    I have a G4 mirror door (1 gig ram, dual 1ghz) on a network with four other machines of equal setup. All other computers don't have this problem, just the one. We use Adobe InDesign, most of our printing is off this program, and it seems to forget wh