How to tune past SQL query??

Hi Team,
Straight to issue --> I am seeing an query running for long time. When i begun to trace that particular query it got over by the time and now how to trace that specific SID and QUERY..
I am working on 10.2.0.4 version DB..
How to trace an sql query after its execution?? pls provide steps how to begin with..
regards
dkoracle

dkoracle wrote:
Hi Team,
Straight to issue --> I am seeing an query running for long time. When i begun to trace that particular query it got over by the time and now how to trace that specific SID and QUERY..
I am working on 10.2.0.4 version DB..
How to trace an sql query after its execution?? pls provide steps how to begin with..Can not be done.
ALTER SESSION SET SQL_TRACE=TRUE;
-- run query again

Similar Messages

  • 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

  • How to get physical SQL query

    Hi All,
    How to get the physical SQL query for the OBIEE reports.
    Thanks in advance,
    Haree.

    Hi Anitha,
    Thanks for your reply,
    I am getting XML script in log file. (Settings > Administration > Manage Sessions > View Log).
    How to get physical SQL query ?
    Thanks,
    Haree

  • How to view the sql query?

    hi,
      how to view the sql query formed from the xml structure in the receiver jdbc?

    You can view SAP Note at
    http://service.sap.com/notes
    But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
    Reason and Prerequisites
    You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
    Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
    Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
    When you want to use a parameter documented here, please be aware to which category it belongs!
    Solution
    The following list shows all available parameters of category 1 or 2. Please note:
    Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
    Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
    The default value of a parameter is always chosen that it does not change the standard functionality
    JDBC Receiver Adapter Parameters
    1. Parameter name: "logSQLStatement"
                  Parameter type: boolean
                  Parameter value: true for any string value, false only for empty string
                  Parameter value default: false (empty String)
                  Available with: SP9
                  Category: 2
                  Description:
                  When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
                  This should be used only during the test phase and not in productive scenarios.
    Regards,
    Prateek

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • How to execute an SQL query present in a string inside an ABAP program?

    hello,
    How to execute an SQL query present in a string inside an ABAP program

    Raut,
    You can execute Native SQl statements.
    Ex: To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:
    EXEC SQL [PERFORMING <form>].
      <Native SQL statement>
    ENDEXEC.
    There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.
    In Native SQL statements, the data is transported between the database table and the ABAP program using host variables. These are declared in the ABAP program, and preceded in the Native SQL statement by a colon (:). You can use elementary structures as host variables. Exceptionally, structures in an INTO clause are treated as though all of their fields were listed individually.
    If the selection in a Native SQL SELECT statement is a table, you can pass it to ABAP line by line using the PERFORMING addition. The program calls a subroutine <form> for each line read. You can process the data further within the subroutine.
    As in Open SQL, after the ENDEXEC statement, SY-DBCNT contains the number of lines processed. In nearly all cases, SY-SUBRC contains the value 0 after the ENDEXEC statement. Cursor operations form an exception: After FETCH, SY-SUBRC is 4 if no more records could be read. This also applies when you read a result set using EXEC SQL PERFORMING.
    EXEC SQL PERFORMING loop_output.
      SELECT connid, cityfrom, cityto
      INTO   :wa
      FROM   spfli
      WHERE  carrid = :c1
    ENDEXEC.
    Pls. Mark If useful

  • How to execute this SQL Query in ABAP Program.

    Hi,
    I have a string which is the SQL Query.
    How to execute this sql Query (SQL_STR) in ABAP Program.
    Code:-
    DATA: SQL_STR type string.
    SQL_STR = 'select * from spfli.'.
    Thanks in Advance,
    Vinay

    Hi Vinay
    Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
    REPORT dynamic_sql_example .
    DATA: BEGIN OF gt_itab OCCURS 1 ,
    line(80) TYPE c ,
    END OF gt_itab .
    DATA gt_restab TYPE .... .
    DATA gv_name(30) TYPE c .
    DATA gv_err(120) TYPE c .
    START-OF-SELECTION .
    gt_itab-line = 'REPORT generated_sql .' .
    APPEND gt_itab .
    gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
    APPEND gt_itab .
    gt_itab-line = SQL_STR .
    APPEND gt_itab .
    gt_itab-line = 'ENDFORM.' .
    APPEND gt_itab .
    GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
    PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
    IF FOUND .
    WRITE:/ gv_err .
    LOOP AT gt_result .
    WRITE:/ .... .
    ENDLOOP .
    *--Serdar

  • How Can I find SQL Query in Database

    Dear Experts,
    How Can I find SQL Query in Database.

    Hi,
    U mena what query got executed in db? u can try V$SQL for it.
    Regards
    Bharath

  • How to write a sql query to retrieve data entered in the past 2 weeks

    Hi,
    I have file names and last accessed date(java.sql.Date format) stored in my database table, I would like to know how I can write a query to get the name of files accessed in the past 2 weeks,I use open sql server at the back end.
    Thanks in advance.

    This has essentially nothing to do with JDBC. JDBC is just an API to execute the SQL language using Java and thus interact with the databases.
    Your problem is related to the SQL language, you don't know how to write the SQL language. I suggest you to go through a SQL tutorial (there is one at w3schools.com) and to read the SQL documentation which come along with the database in question. A decent database manfacturer has a website and probably also a discussion forum / mailinglist as well.
    I'll give you a hint: you can just use equality operators in SQL like everywhere. For example: "WHERE date < somedate".

  • TUNNING A SQL QUERY AND UNSERSTAND EXPLAIN PLAN

    I was trying my handing in tunning sql queries -
    Though I have manged to reduce the cost lil ..creating some index, but have genarated a g8 interesting in tunning - Can some experts ( I know there are lots available :-) ) help me on the approch on "HOW TO TUNE A QUERY"
    moreover I also would like to understand - how to debug a explain plan, - please help ...
    Regards..

    Hi,
    Welcome to this forum...
    I would suggest your to read first the official documentations :
    - The concepts of an Oracle DBMS (this is important to know, because Oracle structures, processes, objects (etc) are the building blocks of your database)
    - SQL reference guide
    - PL/SQL reference guide
    and then at a later stage the Performance and tuning guide:
    You can start there:
    http://download.oracle.com/docs/cd/B14117_01/nav/portal_1.htm
    Once it's done maybe read the Performance and tuning guide:
    http://download.oracle.com/docs/cd/B14117_01/server.101/b10752/toc.htm
    (Chapter 19 explain ... how to interpret the explain plan ..)
    I wish you good chance and be patient: I'm working with Oracle for more that 10 years and I'm still learning! ...
    Rem: The Oracle website is full of interesting articles, and examples, just "search" your special points of interests ..

  • How to construct a sql query when field having single quote

    Hi all,
    I have been working on web application , here is my requirement:
    I'm constructing sql statement dynamically from dynamic user input (form data). In one of the field having single quote.
    while executing the query it is getting problem because of single quote .. so how do i resolve my problem.
    single quote should be there. (I'm using Ms-Access as my database).
    Thanks in advance
    abel

    Use PreparedStatement. Always. It not only eases setting Java objects in a SQL query, but also protects you against SQL injections.
    Prepare yourself: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].

  • How to run a sql query from a button in apex 3.0

    Hi,
    I am brand new and went through/installed the obe project tracker. I have need to create a simple application that displays a result (2 fields, name and license number) based on two parameters (dob and login id) which all are stored in 1 table in the database. I could this very simply in VB or VB.net but have no idea how to do it in apex.
    Please provide guidance,
    Thank you,
    Tom

    Hi Tom,
    Sounds like a report region will satisfy your requirements.
    Create a new report region on one of your pages.
    Choose SQL Report and give the region a title.
    When you get to the "Enter SQL Query or PL/SQL function returning a SQL Query:" step, type:
    SELECT name, license_number
    FROM   <insert_your_table_name_here>
    WHERE  dob = :P<n>_dob
    AND    login_id = :P<n>loginid(replace <n> with the page number that the region is on and use your own table name).
    Don't try to run the page yet - it will give 'No data found'
    Now, go back to the Page Definition screen and add two items in the region you just created - call them P<n>dob and P<n>login_id
    Then, create a button in the same region (to be displayed amongst the region's items) - call it P<n>_GO and click 'Create' (take all the other defaults).
    Now you can run the page, put some values into the fields and click go.
    If you want to get fancier, you can change the text items to select lists etc. - let us know if you need help with that.
    Hope this helps,
    Bryan.

  • How to execute a SQL  Query in Ms-Access

    Hi,
    I've a query which fetches the data from the tables based on daily transactions.
    I mean, the data gets updated daily basis.
    Now, i want to send the user a Ms-access work sheet with the query written, so that when ever the query is executed, it would fetch the records (with latest updates).
    I found some documents in google to, how to write sql query in ms-access.
    How ever, i'm unable to find the connection setup.
    how do i connect to oracle database using ms-access??
    Can any one please help me regarding this.
    Thanks,
    Santhosh

    You can try this tutorials
    http://www.reo.gov/gis/tools/infobase/LinkAccessToOracle.pdf
    Basically steps include,
    Install and configure Oracle client
    Configure ODBC DSN using correct TNS name configured in first step
    Link the table from Msaccess, make sure you linked the table not import it.

  • How to determine a sql query size to display a progress bar

    I would like to show a progress of an sql query within a jsp page.
    Background:
    I have a reporting web application, where over 500 contacts can run reports based on different criteria such as date range....
    I current display a message stating 'executng query please wait', however the users (hate users) do not seem to wait, thereofore they decide to run the query all over again which affected my reportign sever query size (eventually this crashes, stopping all reports)
    Problem:
    The progress bar is not a problem, how would I determine the size of the query at runtime therefore adding the time onto my progress bar.

    Yes it's doable (we do it) but it sure ain't easy.
    We've got about 23,500,000 features (and counting) in a geodata database. Precise spatial selection algorithms are expensive. Really expensive.
    We cannot impose arbitrary limits on search criteria. If the client requires the whole database we are contractually obligated to provide it...
    For online searches We use statistics to approximate the number of features which a given query is likely to return... more or less the same way that the query optimiser behind any half decent (not mysql (5 alteast)) database management system does.
    We have a batch job which records how many features are linked to each distinct value of each search criteria... we just do the calculations (presuming a normal (flat) distribution) and...
    ... if the answer is more than a 100,000 we inform the user that the request must be "batched", and give them a form to fill out confirming there contact details. We run the extract overnight and send the user an email containing a link which allows them to download the result the next morning.
    ... if the answer is more than a million features we inform the user that the request must batched over the weekend... same deal as above, except we do it over the weekend to (a) discourage this; and (b) the official version ensure we have enough time to run the extract without impinging upon the maintenance window.
    ... if the answer is more than 5 million we display our brilliant "subscribe to our DVD service to get the latest version of the whole shebang every three months (or so), so you can kill your own blooody server with these ridiculous searches" form.
    Edited by: corlettk on Dec 5, 2007 11:12 AM

  • How to configure a sql query of 110 lines in a DB Adapter

    Hi all,
    I have a sql query which is 110 lines and i need to use "select"operation in DB Adapter.I dont understand where to put the query in DB Adapter.I worked on a sql query which is 3 or 4 lines but this is the first time iam working on a sql Query with 110 lines.
    Please help me.Give me sme link or any document that i can refer.
    Thanks,
    Kiran

    HI,
    Please use the option of Custom Sql and paste it there.
    it does not matter what operation are you using but the xsd will form accordingly.
    If you need to do only via Select operation in the wizard, than select the tables and add pararmeters in the next screen and try to give the logic there.
    I feel the best thing to do would be with the Custom Sql query.
    And whatever variables you need to pass dyanamically.
    Just put an # symbol before to the column name .
    The variable will be formed.
    Thanks,
    Tirumala Dixit.

Maybe you are looking for

  • Can not update Ipod touch to IOS 5

    I have a ipod touch 4th generation 32gb and I can not update my ipod to the new IOS 5 software. A error message keeps popping up saying that the network connection has timed out. I have tried various things to get rid of this problem restarting my la

  • Amt in words in payslip

    Hi friends. i am designing a payslip (pe51) for an indian client. The requirement is i want to display the net pay amount in words. Pleasecan anybody tell me can we do this. if yes how? Thanks and Regards. Vishal VH

  • N80 SMS Smilies

    Please, please, please can we have smilies on the N80? I appreciate that it is a buiness phone, but when did this ever stop me. PLEASE can we have them on the next firmware update. Thanking you in anticipation.

  • Rfc sender - text file

    I have a interface using rfc sender. When it's executed, a file is created. When the format is a XML, the file is created, but, when I use "File Content Conversion" in "File Adatper" to convert the data in text format, the file is not created. The st

  • Physical path problem

    Hi, In my struts application , I'm using the properties file , which is placed now in C drive . I need to keep that file in my application folder ,but don't know as how to specify the path . My java files path is C:\app-name\src\src-web\java . My cod