My sql query is taking hours to run from toad

SELECT * from (select hr.NAME org_name, ractla.org_id, acct_site.attribute_category,
          acct_site.attribute10 general_agent, arc.reversal_category,arr.reversal_gl_date,ard.reversed_source_id,
          DECODE (acct_site.attribute_category,
                  'COMM', acct_site.attribute9,
                  'IPLAN', acct_site.attribute11,
                  NULL
                 ) broker_number,                       -- changed by Michelle
          SUBSTR (hca.account_number, 1, 12) customer_number,
          ractla.attribute3 plan_type,
          SUBSTR (hp.party_name, 1, 15) customer_name,
          DECODE (ractla.attribute_category,
                  'Commercial Receivables', ractla.attribute1,
                  'Subscriber Receivables', ractla.attribute1,
                  NULL
                 ) product,                                        --x Product
          rax.trx_number trx_number, rax.trx_date transaction_date,
          DECODE
             (SIGN (INSTR (rax.attribute4, '/')),
              1, TO_DATE
                        (   '01'
                         || TO_CHAR
                                  (DECODE (SIGN (INSTR (rax.attribute4, '/')),
                                           1, TO_DATE
                                                     (SUBSTR (rax.attribute4,
                                                              1,
                                                              10
                                                      'rrrr/mm/dd'
                                           NULL
                                   'MON-RRRR'
                         'DD-MON-RRRR'
              NULL
             ) coverage_month, 
          DECODE (SIGN (INSTR (rax.attribute4, '/')),
                  1, TO_DATE (SUBSTR (rax.attribute4, 1, 10), 'rrrr/mm/dd'),
                  NULL
                 ) due_date,
          DECODE (acct_site.attribute_category,
                  'COMM', SUBSTR (hca.account_number, 1, 6),
                  acct_site.attribute10
                 ) employer_group,
          DECODE (arc.reversal_category,
                  'NSF', TRUNC (arr.creation_date),
                  'REV', TRUNC (arr.creation_date),
                  DECODE (arr.reversal_gl_date,
                          NULL, TRUNC (arr.apply_date),
                          DECODE (ard.reversed_source_id,
                                  NULL, TRUNC (arr.apply_date),
                                  TRUNC (arr.creation_date)
                 ) as application_date,     
                 arr.apply_date,   
                 arr.creation_date,                       --9/8/03
          arc.receipt_number receipt_number, arc.receipt_date receipt_date,
          arr.amount_applied applied_amount, rax.attribute1 company,
          rax.attribute2 division, ractla.attribute2 coverage_plan,                                                              -- (Plan Code)
          DECODE (acct_site.attribute_category,
                  'IPLAN', acct_site.attribute13,
                  'SH', acct_site.attribute8,
                  NULL
                 ) coverage_type,
          ps.amount_due_original trans_amount,
          NVL (ps.amount_due_remaining, 0) trans_amount_remaining,
          SUBSTR (hre.first_name || ' ' || hre.middle_name || ' '
                  || hre.last_name,
                  1,
                  25
                 ) salesrep_name,
          SUBSTR (acct_site.attribute5, 1, 5) salesrep_extension,
          hca.attribute4 SOURCE 
     FROM apps.ra_customer_trx_all rax,                        -- invoice info
          apps.ar_payment_schedules_all ps,
          apps.ra_cust_trx_types_all rat,
          apps.hz_cust_accounts_all hca,
          apps.hz_parties hp,
          apps.ar_receivable_applications_all arr,
          apps.ar_cash_receipts_all arc,                      --- receipt info
          apps.hr_operating_units hr,
          apps.hr_employees hre,
          apps.hz_cust_acct_sites_all acct_site,
          apps.hz_cust_site_uses_all acct_site_use,   --added by tapas on 7/16
          apps.ra_customer_trx_lines_all ractla,
          apps.ar_distributions_all ard
    WHERE
    hca.cust_account_id = rax.bill_to_customer_id 
      AND ps.customer_trx_id = rax.customer_trx_id
      AND rat.cust_trx_type_id = rax.cust_trx_type_id
      AND rat.org_id = rax.org_id
      AND arr.applied_customer_trx_id = rax.customer_trx_id
      AND arr.status = 'APP'
      AND arr.cash_receipt_id = arc.cash_receipt_id
      AND hr.organization_id = rax.org_id
      AND rax.customer_trx_id = ractla.customer_trx_id
      AND ractla.line_number = 1
      AND rax.bill_to_site_use_id = acct_site_use.site_use_id
      AND hca.cust_account_id = acct_site.cust_account_id
      AND acct_site.cust_acct_site_id = acct_site_use.cust_acct_site_id
      AND hca.party_id = hp.party_id 
      AND acct_site.attribute4 = hre.employee_id(+)
      AND hr.NAME = 'Commercial Group'
      AND ard.source_table = 'RA'
      AND ard.source_id = arr.receivable_application_id) app
      where app.application_date between :start_date and :end_Date
     and app.application_date <> app.apply_date
     and app.applied_amount>0;
This is my query..due to some requirement i have written an inline view. The query is getting executed without inline view and even after including inline view but when i included the condition "app.applied_amount>0" its taking hours and i dont see it complete. Please advise. Urgently needed as a discoverer report needs to be built based on this.
Thanks.
Edited by: 958913 on Oct 8, 2012 3:52 PM
Edited by: 958913 on Oct 8, 2012 4:19 PM
Edited by: 958913 on Oct 8, 2012 4:33 PM

Hi,
the next action plan i have taken is as i need to write a condition that is based on application date(which is not a database column and is getting by a decode statement in the select) i have removed that decode statement from select and written in inline view and there by adding in where condition. Here is the query and still its taking time to run.
/* Formatted on 2012/10/09 13:51 (Formatter Plus v4.8.8) */
SELECT hr.NAME org_name, ractla.org_id, acct_site.attribute_category,
       acct_site.attribute10 general_agent, arc.reversal_category,
       arr.reversal_gl_date, ard.reversed_source_id,
       DECODE (acct_site.attribute_category,
               'COMM', acct_site.attribute9,
               'IPLAN', acct_site.attribute11,
               NULL
              ) broker_number,                          -- changed by Michelle
       SUBSTR (hca.account_number, 1, 12) customer_number,
       ractla.attribute3 plan_type,
       SUBSTR (hp.party_name, 1, 15) customer_name,
       DECODE (ractla.attribute_category,
               'Commercial Receivables', ractla.attribute1,
               'Subscriber Receivables', ractla.attribute1,
               NULL
              ) product,                                           --x Product
       rax.trx_number trx_number, rax.trx_date transaction_date,
       DECODE
          (SIGN (INSTR (rax.attribute4, '/')),
           1, TO_DATE (   '01'
                       || TO_CHAR (DECODE (SIGN (INSTR (rax.attribute4, '/')),
                                           1, TO_DATE
                                                     (SUBSTR (rax.attribute4,
                                                              1,
                                                              10
                                                      'rrrr/mm/dd'
                                           NULL
                                   'MON-RRRR'
                       'DD-MON-RRRR'
           NULL
          ) coverage_month,
       DECODE (SIGN (INSTR (rax.attribute4, '/')),
               1, TO_DATE (SUBSTR (rax.attribute4, 1, 10), 'rrrr/mm/dd'),
               NULL
              ) due_date,
       DECODE (acct_site.attribute_category,
               'COMM', SUBSTR (hca.account_number, 1, 6),
               acct_site.attribute10
              ) employer_group,
       app.application_date,
       arr.apply_date, arr.creation_date,                             --9/8/03
                                         arc.receipt_number receipt_number,
       arc.receipt_date receipt_date, arr.amount_applied applied_amount,
       rax.attribute1 company, rax.attribute2 division,
       ractla.attribute2 coverage_plan,                         -- (Plan Code)
       DECODE (acct_site.attribute_category,
               'IPLAN', acct_site.attribute13,
               'SH', acct_site.attribute8,
               NULL
              ) coverage_type,
       ps.amount_due_original trans_amount,
       NVL (ps.amount_due_remaining, 0) trans_amount_remaining,
       SUBSTR (hre.first_name || ' ' || hre.middle_name || ' '
               || hre.last_name,
               1,
               25
              ) salesrep_name,
       SUBSTR (acct_site.attribute5, 1, 5) salesrep_extension,
       hca.attribute4 SOURCE
  FROM apps.ra_customer_trx_all rax,                           -- invoice info
       apps.ar_payment_schedules_all ps,
       apps.ra_cust_trx_types_all rat,
       apps.hz_cust_accounts_all hca,
       apps.hz_parties hp,
       apps.ar_receivable_applications_all arr,
       apps.ar_cash_receipts_all arc,                         --- receipt info
       apps.hr_operating_units hr,
       apps.hr_employees hre,
       apps.hz_cust_acct_sites_all acct_site,
       apps.hz_cust_site_uses_all acct_site_use,      --added by tapas on 7/16
       apps.ra_customer_trx_lines_all ractla,
       apps.ar_distributions_all ard,
       (select rax1.customer_trx_id,DECODE (arc1.reversal_category,
                  'NSF', TRUNC (arr1.creation_date),
                  'REV', TRUNC (arr1.creation_date),
                  DECODE (arr1.reversal_gl_date,
                          NULL, TRUNC (arr1.apply_date),
                          DECODE (ard1.reversed_source_id,
                                  NULL, TRUNC (arr1.apply_date),
                                  TRUNC (arr1.creation_date)
                 ) as application_date
from  apps.ar_receivable_applications_all arr1,
          apps.ar_cash_receipts_all arc1, 
          apps.ra_customer_trx_all rax1,
          apps.ar_distributions_all ard1
where  arr1.applied_customer_trx_id = rax1.customer_trx_id
      AND arr1.status = 'APP'
      AND arr1.cash_receipt_id = arc1.cash_receipt_id
       AND ard1.source_table = 'RA'
      AND ard1.source_id = arr1.receivable_application_id
      ) app
WHERE hca.cust_account_id = rax.bill_to_customer_id
   AND app.customer_trx_id = rax.customer_trx_id
   AND arr.apply_date <> app.application_date
   and app.application_date between :start_date and :end_date
   --AND rax.trx_number IN ('52715888', '52689753')
   AND ps.customer_trx_id = rax.customer_trx_id
   AND rat.cust_trx_type_id = rax.cust_trx_type_id
   AND rat.org_id = rax.org_id
   AND arr.applied_customer_trx_id = rax.customer_trx_id
   AND arr.status = 'APP'
   AND arr.cash_receipt_id = arc.cash_receipt_id
   AND hr.organization_id = rax.org_id
   AND rax.customer_trx_id = ractla.customer_trx_id
   AND ractla.line_number = 1
   AND rax.bill_to_site_use_id = acct_site_use.site_use_id
   AND hca.cust_account_id = acct_site.cust_account_id
   AND acct_site.cust_acct_site_id = acct_site_use.cust_acct_site_id
   AND hca.party_id = hp.party_id
   AND acct_site.attribute4 = hre.employee_id(+)
   AND hr.NAME = 'Commercial Group'
   AND ard.source_table = 'RA'
   AND ard.source_id = arr.receivable_application_id

Similar Messages

  • Excel ADODB Sql Query Execution taking hours when manipulate excel tables

    Hello All 
    I have 28000 records with 8 column in an sheet. When I convert the sheet into ADODB database and copy to new
    excel using below code it is executing in less than a min
    Set Tables_conn_obj = New ADODB.Connection
    Tables_conn_str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Table_Filename & ";Extended Properties=""Excel 12.0;ReadOnly=False;HDR = Yes;IMEX=1"""
    Tables_conn_obj.Open Tables_conn_str
    First_Temp_sqlqry = "Select * INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1] Table [first - Table$];" Tables_conn_obj.Execute First_Temp_sqlqry
    But when I change the query to manipulate one column in current table based on another table in the same excel
    and try to copy the results in another excel, it is taking more than one hour.. why it is taking this much time when both the query results returns the same number of rows and column. I almost spend one week and still not able to resolve this issue.
    Even I tried copyfromrecordset, getrows(), getstring(), Looping each recordset fields options all of them taking
    same amount of time. Why there is huge difference in execution time.
    Important note: Without into statement even below query is executing in few seconds.
    select ( ''''''manipulating first column based on other table data''''''''''''''
    iif(
    [Second - Table$].[Policy Agent] = (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01') ) , (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01')) ,
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$]where [ACA T$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01') ), (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01')) ,
    [Second - Table$].[Policy Agent] ))) as [Policy Agent],
    ''''''summing up all other columns''''''''''''''
    (iif(isnull(sum([Second - Table$].[Auto BW-Line Of Business Detail])),0,sum([Second - Table$].[Auto BW-Line Of Business Detail]))) as [Auto BW-Line Of Business Detail],(iif(isnull(sum([Second - Table$].[Auto Farmers])),0,sum([Second - Table$].[Auto Farmers]))) as [Auto Farmers],(iif(isnull(sum([Second - Table$].[MCA])),0,sum([Second - Table$].[MCA]))) as [MCA],(iif(isnull(sum([Second - Table$].[CEA])),0,sum([Second - Table$].[CEA]))) as [CEA],(iif(isnull(sum([Second - Table$].[Commercial P&C])),0,sum([Second - Table$].[Commercial P&C]))) as [Commercial P&C],(iif(isnull(sum([Second - Table$].[Comm WC])),0,sum([Second - Table$].[Comm WC]))) as [Comm WC],(iif(isnull(sum([Second - Table$].[Fire Farmers])),0,sum([Second - Table$].[Fire Farmers]))) as [Fire Farmers],(iif(isnull(sum([Second - Table$].[Flood])),0,sum([Second - Table$].[Flood]))) as [Flood],(iif(isnull(sum([Second - Table$].[Kraft Lake])),0,sum([Second - Table$].[Kraft Lake]))) as [Kraft Lake],(iif(isnull(sum([Second - Table$].[Life])),0,sum([Second - Table$].[Life]))) as [Life],(iif(isnull(sum([Second - Table$].[Foremost])),0,sum([Second - Table$].[Foremost]))) as [Foremost],(iif(isnull(sum([Second - Table$].[Umbrella])),0,sum([Second - Table$].[Umbrella]))) as [Umbrella],(iif(isnull(sum([Second - Table$].[MCNA])),0,sum([Second - Table$].[MCNA]))) as [MCNA]
    INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1]
    from [Second - Table$] group by [Second - Table$].[Policy Agent] ;

    Hi Fei,
      Thank you so much for the reply post. I just executed the same above SQL without INTO Statement and assigned the SQL result to ADODB recordset as below. If the time difference is due to the SQL query then below statements also should execute for hours
    right, but it gets executed in seconds. But to copy the recordset to excel again it is taking hours. I tried copyfromrecordset,
    getrows(), getstring(), Looping each recordset fields options and all of them taking same amount of time. Please let me know there is delay in time for this much small data
    Even I tried to typecast all columns to double, string in SQL and still the execution time  is not reduced. 
    First_Temp_Recordset.Open sql_qry, Tables_conn_obj, adOpenStatic, adLockOptimistic ''' OR SET First_Temp_Recordset = Tables_conn_obj.Execute sql_qry

  • Excel ADODB Sql Query Execution taking hours when manipulate excel tables why?

    I have 28000 records with 8 column in an sheet. When I convert the sheet into ADODB database and copy to new excel using below code it is executing in less than a min
    Set Tables_conn_obj = New ADODB.Connection Tables_conn_str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Table_Filename & ";Extended Properties=""Excel 12.0;ReadOnly=False;HDR = Yes;IMEX=1""" Tables_conn_obj.Open
    Tables_conn_str First_Temp_sqlqry = "Select * INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1] Table [first - Table$];" Tables_conn_obj.Execute First_Temp_sqlqry
    But when I change the query to manipulate one column in current table based on another table in the same excel and try to copy the results in another excel, it is taking more than one hour.. why it is taking this much time when both the query results returns
    the same number of rows and column. I almost spend one week and still not able to resolve this issue.
    Even I tried copyfromrecordset, getrows(), getstring(), Looping each recordset fields options all of them taking same amount of time. Appreciate any inputs...
    select ( ''''''manipulating first column based on other table data''''''''''''''
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where
    [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01') ) , (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate]
    = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[new_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] > '2014-10-01')) ,
    iif( [Second - Table$].[Policy Agent] = (select max([ACAT$].[Old_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate] = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$]where
    [ACA T$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01') ), (select max([ACAT$].[new_Agent_number]) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent] and [ACAT$].[ACAT_EffectiveDate]
    = ( select MAX([ACAT$].[ACAT_EffectiveDate] ) from [ACAT$] where [ACAT$].[Old_Agent_number] = [Second - Table$].[Policy Agent]and [ACAT$].[ACAT_EffectiveDate] <= '2014-10-01')) ,
    [Second - Table$].[Policy Agent] ))) as [Policy Agent],
    ''''''summing up all other columns''''''''''''''
    (iif(isnull(sum([Second - Table$].[Auto BW-Line Of Business Detail])),0,sum([Second - Table$].[Auto BW-Line Of Business Detail]))) as [Auto BW-Line Of Business Detail],(iif(isnull(sum([Second - Table$].[Auto Farmers])),0,sum([Second - Table$].[Auto Farmers])))
    as [Auto Farmers],(iif(isnull(sum([Second - Table$].[MCA])),0,sum([Second - Table$].[MCA]))) as [MCA],(iif(isnull(sum([Second - Table$].[CEA])),0,sum([Second - Table$].[CEA]))) as [CEA],(iif(isnull(sum([Second - Table$].[Commercial P&C])),0,sum([Second
    - Table$].[Commercial P&C]))) as [Commercial P&C],(iif(isnull(sum([Second - Table$].[Comm WC])),0,sum([Second - Table$].[Comm WC]))) as [Comm WC],(iif(isnull(sum([Second - Table$].[Fire Farmers])),0,sum([Second - Table$].[Fire Farmers]))) as [Fire
    Farmers],(iif(isnull(sum([Second - Table$].[Flood])),0,sum([Second - Table$].[Flood]))) as [Flood],(iif(isnull(sum([Second - Table$].[Kraft Lake])),0,sum([Second - Table$].[Kraft Lake]))) as [Kraft Lake],(iif(isnull(sum([Second - Table$].[Life])),0,sum([Second
    - Table$].[Life]))) as [Life],(iif(isnull(sum([Second - Table$].[Foremost])),0,sum([Second - Table$].[Foremost]))) as [Foremost],(iif(isnull(sum([Second - Table$].[Umbrella])),0,sum([Second - Table$].[Umbrella]))) as [Umbrella],(iif(isnull(sum([Second - Table$].[MCNA])),0,sum([Second
    - Table$].[MCNA]))) as [MCNA]
    INTO [Excel 12.0;DATABASE=C:\Prod Validation\Database\Second Acat Table.xlsb].[Sheet1]
    from [Second - Table$] group by [Second - Table$].[Policy Agent] ;

    Hi Fei,
      Thank you so much for the reply post. I just executed the same above SQL without INTO Statement and assigned the SQL result to ADODB recordset as below. If the time difference is due to the SQL query then below statements also should execute for hours
    right, but it gets executed in seconds. But to copy the recordset to excel again it is taking hours. I tried copyfromrecordset,
    getrows(), getstring(), Looping each recordset fields options and all of them taking same amount of time. Please let me know there is delay in time for this much small data
    Even I tried to typecast all columns to double, string in SQL and still the execution time  is not reduced. 
    First_Temp_Recordset.Open sql_qry, Tables_conn_obj, adOpenStatic, adLockOptimistic ''' OR SET First_Temp_Recordset = Tables_conn_obj.Execute sql_qry

  • With one condition included my discoverer report is taking hours to run

    Hi,
    I am trying to build a discoverer report based on a view and i have defined couple of conditions as per the business requirement. Here is my view which is executing fine from database and at discoverer level.
    Now the requirement is to get the details with conditions
    1. Application_date is not equal to apply date
    2. Applied_amount>0
    parameters should be
    Application_date low and high
    The report is successfully executing when i use condition1 that is application_date<>apply date with parameters mentioned.
    But when i define second condition at report level that applied_amount>0, its taking hours to run.
    Please advise me the way to use this condition2 so that it should be executed in normal time.
    Thanks,
    Prathyusha.
    Edited by: 958913 on Oct 10, 2012 1:28 PM

    Hi Srini,hussein,
    Thanks so much.
    Yes srini that is related to my post. I have tried all the options to make that condition workout. But hard luck i could nt able to make this work out.
    Im still wondered my query is successfully getting executed in database fine and when i give any condition on applied amount its taking hours to run from discoverer desktop and i dont find it executed anytime till now.
    I am not sure about enabling this trace option as i reviewed the ID's suggested by you and seems that all needs to be done with the help of DBA. But i dont have that much time to make this workout. This is an immediate business requirement and i have never seen this problem anytime with discoverer desktop.
    Any help would be appreciated.
    Thanks,
    Prathyusha.

  • Query is taking hours to give output

    Hi All,
    The following query is taking hours to give o/p,is there any way to optimize it for a better performance.
    I took the expalin plan for the sql.
    SELECT SUM(L.EXTENDED_AMOUNT)
    FROM mtl_categories cat,
    mtl_item_categories mic ,
    RA_CUSTOMER_TRX_ALL H ,
    RA_CUST_TRX_TYPES_ALL T ,
    RA_CUSTOMER_TRX_LINES_ALL L
    WHERE cat.category_id = 4341
    AND cat.category_id = mic.category_id
    AND mic.organization_id = 4
    AND mic.category_set_id = 4
    AND mic.inventory_item_id = l.inventory_item_id
    AND TO_CHAR(H.TRX_DATE,'MON-RR')= 'MAR-12'
    AND l.CUSTOMER_TRX_ID = H.CUSTOMER_TRX_ID
    AND T.TYPE = 'INV'
    AND T.NAME NOT IN ('PB-INV-MEMO', 'PB-RMA-MEMO','PB-CM-MEMO','JM-INV-MEMO','JM-RMA-MEMO','JM-CM-MEMO','JM-CO','PB-CO')
    AND H.CUST_TRX_TYPE_ID = T.CUST_TRX_TYPE_ID
    AND H.BILL_TO_CUSTOMER_ID =3284

    explain plan for the sql
    | Id | Operation           | Name           | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT |           | 1 | 89 | 417 |
    | 1 | SORT AGGREGATE      |           | 1 | 89 | |
    | 2 | TABLE ACCESS BY INDEX ROWID | RA_CUSTOMER_TRX_LINES_ALL | 1 | 15 | 3 |
    | 3 | NESTED LOOPS           |           | 1 | 89 | 417 |
    | 4 | NESTED LOOPS      |           | 42 | 3108 | 291 |
    | 5 | MERGE JOIN CARTESIAN      |           | 56 | 2856 | 11 |
    | 6 | NESTED LOOPS      |           | 1 | 28 | 8 |
    | 7 | NESTED LOOPS      |           | 1 | 13 | 1 |
    |* 8 | INDEX UNIQUE SCAN      | MTL_CATEGORIES_B_U1      | 1 | 5 | 1 |
    |* 9 | INDEX UNIQUE SCAN      | MTL_CATEGORIES_TL_U1      | 1 | 8 | |
    | 10 | TABLE ACCESS BY INDEX ROWID | MTL_ITEM_CATEGORIES      | 1 | 15 | 7 |
    |* 11 | INDEX RANGE SCAN      | MTL_ITEM_CATEGORIES_N1      | 1 | | 2 |
    | 12 | BUFFER SORT           |           | 57 | 1311 | 4 |
    |* 13 | TABLE ACCESS FULL      | RA_CUST_TRX_TYPES_ALL      | 57 | 1311 | 3 |
    |* 14 | TABLE ACCESS BY INDEX ROWID      | RA_CUSTOMER_TRX_ALL | 1 | 23 | 5 |
    |* 15 | INDEX RANGE SCAN      | RA_CUSTOMER_TRX_N11      | 26 | | 2 |
    |* 16 | INDEX RANGE SCAN      | JM_RA_CUSTOMER_TRX_LINES_N1 | 1 | | 2 |
    8 - access("B"."CATEGORY_ID"=4341)
    9 - access("T"."CATEGORY_ID"=4341 AND "T"."LANGUAGE"=:B1)
         filter("B"."CATEGORY_ID"="T"."CATEGORY_ID")
    11 - access("MIC"."ORGANIZATION_ID"=4 AND "MIC"."CATEGORY_SET_ID"=4 AND
         "MIC"."CATEGORY_ID"=4341)
         filter("B"."CATEGORY_ID"="MIC"."CATEGORY_ID")
    13 - filter("SYS_ALIAS_0000"."TYPE"='INV' AND "SYS_ALIAS_0000"."NAME"<>'PB-INV-MEMO' AND
         "SYS_ALIAS_0000"."NAME"<>'PB-RMA-MEMO' AND "SYS_ALIAS_0000"."NAME"<>'PB-CM-MEMO' AND
         "SYS_ALIAS_0000"."NAME"<>'JM-INV-MEMO' AND "SYS_ALIAS_0000"."NAME"<>'JM-RMA-MEMO' AND
         "SYS_ALIAS_0000"."NAME"<>'JM-CM-MEMO' AND "SYS_ALIAS_0000"."NAME"<>'JM-CO' AND
         "SYS_ALIAS_0000"."NAME"<>'PB-CO')
    14 - filter(TO_CHAR("H"."TRX_DATE",'MON-RR')='MAR-12')
    15 - access("H"."BILL_TO_CUSTOMER_ID"=3284 AND
         "H"."CUST_TRX_TYPE_ID"="SYS_ALIAS_0000"."CUST_TRX_TYPE_ID")
    16 - access("L"."CUSTOMER_TRX_ID"="H"."CUSTOMER_TRX_ID" AND
         "MIC"."INVENTORY_ITEM_ID"="L"."INVENTORY_ITEM_ID")
    Note: cpu costing is off

  • Put SQL query in a function/ call function from region

    How can I write a SQL query (like SELECT EMPNO, ENAME, JOB FROM EMP) as PL/SQL function, and then call this function from the PL/SQL Function Returning SQL Statement region?
    Thanks, Tom

    thanks jverd for your quick reply.
    I know passing in a reference to an object will do the job if I want to change the value several parameters in one function call.
    But I want to ask, is there any other ways?
    the following code works.....
    public class TestParameter {
         public static void main(String[] args) {
              Test2 t2 = new Test2();
              invokeChange(t2);
              System.out.println("x = " + t2.x + "\t y = " + t2.y);
         static void invokeChange(Test2 t2) {
              t2.x = 10;
              t2.y = 15;          
    class Test2 {     
         int x;
         int y;     
    }

  • Sql query is taking more time

    Hi all,
    db:oracle 9i
    I am facing below query prob.
    prob is that query is taking more time 45 min than earliar (10 sec).
    please any one suggest me .....
    SQL> SELECT MAX (tdar1.ID) ID, tdar1.request_id, tdar1.lolm_transaction_id,
    2 tdar1.transaction_version
    3 FROM transaction_data_arc tdar1
    4 WHERE tdar1.transaction_name ='O96U '
    5 AND tdar1.transaction_type = 'REQUEST'
    6 AND tdar1.message_type_code ='PCN'
    7 AND NOT EXISTS (
    8 SELECT NULL
    9 FROM transaction_data_arc tdar2
    10 WHERE tdar2.request_id = tdar1.request_id
    11 AND tdar2.lolm_transaction_id != tdar1.lolm_transaction_id
    12 AND tdar2.ID > tdar1.ID)
    13 GROUP BY tdar1.request_id,
    14 tdar1.lolm_transaction_id,
    15 tdar1.transaction_version;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=17 Card=1 Bytes=42)
    1 0 SORT (GROUP BY) (Cost=12 Card=1 Bytes=42)
    2 1 FILTER
    3 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRANSACTION_DATA_ARC
    ' (Cost=1 Card=1 Bytes=42)
    4 3 INDEX (RANGE SCAN) OF 'NK_TDAR_2' (NON-UNIQUE) (Cost
    =3 Card=1)
    5 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRANSACTION_DATA_ARC
    ' (Cost=5 Card=918 Bytes=20196)
    6 5 INDEX (RANGE SCAN) OF 'NK_TDAR_7' (NON-UNIQUE) (Cost
    =8 Card=4760)

    prob is that query is taking more time 45 min than earliar (10 sec).Then something must have changed (data growth/stale statistics/...?).
    You should post as much details as possible, how and what it is described in the FAQ, see:
    *3. How to improve the performance of my query? / My query is running slow*.
    When your query takes too long...
    How to post a SQL statement tuning request
    SQL and PL/SQL FAQ
    Also, given your database version, using NOT IN instead of NOT EXISTS might make a difference (but they're not the same).
    See: SQL and PL/SQL FAQ

  • How to know which sql query is taking time for concurrent program

       Hi sir,
    I am running concurrent program,that is taking time to execute ,i want to know which sql query causing performance
    Thanaks,
    Sreekanth

    Hi,
    My Learning: Diagnosing Oracle Applications Concurrent Programmes - 11i/R12
    How to run a Trace for a Concurrent Program? (Doc ID 415640.1)
    FAQ: Common Tracing Techniques in Oracle E-Business Applications 11i and R12 (Doc ID 296559.1)
    How To Get Level 12 Trace And FND Debug File For Concurrent Programs (Doc ID 726039.1)
    How To Trace a Concurrent Request And Generate TKPROF File (Doc ID 453527.1)
    Regards
    Yoonas

  • How to build sql query for view object at run time

    Hi,
    I have a LOV on my form that is created from a view object.
    View object is read-only and is created from a SQL query.
    SQL query consists of few input parameters and table joins.
    My scenario is such that if input parameters are passed, i have to join extra tables, otherwise, only one table can fetch the results I need.
    Can anyone please suggest, how I can solve this? I want to build the query for view object at run time based on the values passed to input parameters.
    Thanks
    Srikanth Addanki

    As I understand you want to change the query at run time.
    If this is what you want, you can use setQuery Method then use executeQuery.
    http://download.oracle.com/docs/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ViewObjectImpl.html#setQuery_java_lang_String_

  • Query displays no output when run from sqlplus and from procedure its displ

    Hi Guys,
    When i ran the below query, it gives me "no rows selected". I made a procedure for the below query by making it a cursor. I just tried to display the total number of records in the procedure. When ran, it showed me some number. I dont understand , why when ran just as a sql query didnt showed any output and when ran as a procedure showing some output.
    select cust_account_id
    ,related_cust_account_id
    ,object_version_number
    ,ship_to_flag
    ,status
    from apps.HZ_CUST_ACCT_RELATE re
    where
    nvl(re.bill_to_flag,'N') ='N'
    and re.customer_reciprocal_flag = 'Y'
    and re.status = 'A';
    declare
    cursor c1 is the above query
    v_count number;
    begin
    for rec in c1 loop
    v_count := v_count + 1;
    end loop;
    dbms_output.put_line(' V-Count is:' || v_count);
    end;
    also tried to print the values of the select when count is 10, it showed some values. But why is it not showing any values when ran just as a sql query.
    Help Appreciated
    Thanks

    Thanks Warren n Dmytro,
    Actually, the problem is that table has 1769645 rows of data. I wrote a cursor as defined above in a procedure. With that where condition, it doesnt have any values and so displays no rows. Its taking 5 min to run that query and get me the output.
    In the begin, I want to open that cursor using "for rec in c loop" and write one more select statement which is:
    begin
    for rec in c loop
    begin
    select count(*) into l_count
    from hz_cust_acct_relate_all
    where cust_account_id = rec.cust_account_id
    and related_cust_account_id = rec.related_cust_account_id;
    exception
    when others then
    dbms_output.put_line(-265676,"SOme err msg");
    end;
    if l_count = 0 then
    now my question is, if my cursor is not returning any rows, then the query written to get l_count will be executed or not. I am passing the cursors cust_account_id and related_cust_account_id values to this query. but that cursor is returning no data.
    so what will happen to the code that i wrote. Will it hang or will it continue. Or should i write when no_data_found exception to handle when no rows are returned.
    or can in include " exit when c%notfound after for loop". when we use open fetch and close, then we will write this exit when. can we write when using for rec in c loop syntax.
    coz when i run that procedure, it jsut hangs like that forever. how to handle it or how to tune it.
    help appreciated
    thanks

  • PL/SQL procedure is 10x slower when running from weblogic

    Hi everyone,
    we've developed a PL/SQL procedure performing reporting - the original solution was written in Java but due to performance problems we've decided to switch this particular piece to PL/SQL. Everything works fine as long as we execute the procedure from SQL Developer - the batch processing 20000 items finishes in about 80 seconds, which is a serious improvement compared to the previous solution.
    But once we call the very same procedure (on exactly the same data) from weblogic, the performance seriously drops - instead of 80 seconds it suddenly runs for about 23 minutes, which is 10x slower. And we don't know why this happens :-(
    We've profiled the procedure (in both environments) using DBMS_PROFILER, and we've found that if the procedure is executed from Weblogic, one of the SQL statements runs noticeably slower and consumes about 800 seconds (90% of the total run time) instead of 0.9 second (2% of the total run time), but we're not sure why - in both cases this query is executed 32742-times, giving 24ms vs. 0.03ms in average.
    The SQL is
    SELECT personId INTO v_personId FROM (            
            SELECT personId FROM PersonRelations
            WHERE extPersonId LIKE v_person_prefix || '%'
    ) WHERE rownum = 1;Basically it returns an ID of the person according to some external ID (or the prefix of the ID). I do understand why this query might be a performance problem (LIKE operator etc.), but I don't understand why this runs quite fast when executed from SQL Developer and 10x slower when executed from Weblogic (exactly the same data, etc.).
    Ve're using Oracle 10gR2 with Weblogic 10, running on a separate machine - there are no other intensive tasks, so there's nothing that could interfere with the oracle process. According to the 'top' command, the wait time is below 0.5%, so there should be no serious I/O problems. We've even checked JDBC connection pool settings in Weblogic, but I doubt this issue is related to JDBC (and everything looks fine anyway). The statistics are fresh and the results are quite consistent.
    Edited by: user6510516 on 17.7.2009 13:46

    The setup is quite simple - the database is running on a dedicated database server (development only). Generally there are no 'intensive' tasks running on this machine, especially not when the procedure I'm talking about was executed. The application server (weblogic 10) is running on different machine so it does not interfere with the database (in this case it was my own workstation).
    No, the procedure is not called 20000x - we have a table with batch of records we need to process, with a given flag (say processed=0). The procedure reads them using a cursor and processes the records one-by-one. By 'processing' I mean computing some sums, updating other table, etc. and finally switching the record to processed=1. I.e. the procedure looks like this:
    CREATE PROCEDURE process_records IS
        v_record records_to_process%ROWTYPE;
    BEGIN
         OPEN records_to_process;
         LOOP
              FETCH records_to_process INTO v_record;
              EXIT WHEN records_to_process%NOTFOUND;
              -- process the record (update table A, insert a record into B, delete from C, query table D ....)
              -- and finally mark the row as 'processed=1'
         END LOOP;
         CLOSE records_to_process;
    END process_records;The procedure is actually part of a package and the cursor 'records_to_process' is defined in the body. One of the queries executed in the procedure is the SELECT mentioned above (the one that jumps from 2% to 90%).
    So the only thing we actually do in Weblogic is
    CallableStatement cstmt = connection.prepareCall("{call ProcessPkg.process_records}");
    cstmt.execute();and that's it - there is only one call to the JDBC, so the network overhead shouldn't be a problem.
    There are 20000 rows we use for testing - we just update them to 'processed=0' (and clear some of the other tables). So actually each run uses exactly the same data, same code paths and produces the very same results. Yet when executed from SQL developer it takes 80 seconds and when executed from Weblogic it takes 800 seconds :-(
    The only difference I've just noticed is that when using SQL Developer, we're using PL/SQL notation, i.e. "BEGIN ProcessPkg.process_records; END;" instead of "{call }" but I guess that's irrelevant. And yet another difference - weblogic uses JDBC from 10gR2, while the SQL Developer is bundled with JDBC from 11g.

  • Error while executing SQL query -' Must Specify Table to select from'

    Hi all,
    While executing query using query generator
    it shows error message
    [Microsoft][SQL Native Client][SQL Server]Must specify table to select from.
    2). [Microsoft][SQL Nativ
    SELECT T1.ItemCode, T1.Dscription AS 'Item Description', T1.Quantity, T1.Price, T1.LineTotal,
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-90 AND T1.LineNum=T2.LineNum) as 'BEDAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-60 AND T1.LineNum=T2.LineNum) as 'ECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=7 AND T1.LineNum=T2.LineNum) as 'HECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=1 AND T1.LineNum=T2.LineNum) as 'VATAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=4 AND T1.LineNum=T2.LineNum) as 'CSTAmt'
    FROM dbo.[OPCH] T0  INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN PCH4 T2 ON T2.DocEntry=T0.DocEntry
    WHERE T0.DocDate >='[%0]' AND  T0.DocDate <='[%1]' AND T0.DocType = 'I'
    GROUP BY T1.ItemCode,T1.Dscription,T1.Quantity, T1.Price, T1.LineTotal,T0.DocEntry,T1.DocEntry,T1.LineNum,T2.LineNum
    It's executing fine in MS SQL Server Studio Management.
    Please give y'r ideas to solve the problem.
    Jeyakanthan

    try this, it works fine in my B1:
    SELECT T1.ItemCode, T1.Dscription AS 'Item Description', T1.Quantity, T1.Price, T1.LineTotal,
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-90 AND T1.LineNum=T2.LineNum) as 'BEDAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=-60 AND T1.LineNum=T2.LineNum) as 'ECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=7 AND T1.LineNum=T2.LineNum) as 'HECSAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=1 AND T1.LineNum=T2.LineNum) as 'VATAmt',
    (Select SUM(T2.TaxSum) From PCH4 T2 Where T0.DocEntry=T2.DocEntry AND T2.staType=4 AND T1.LineNum=T2.LineNum) as 'CSTAmt'
    FROM dbo.OPCH T0  INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN PCH4 T2 ON T2.DocEntry=T0.DocEntry
    WHERE T0.DocDate >='[%0]' AND  T0.DocDate <='[%1]' AND T0.DocType = 'I'
    GROUP BY T1.ItemCode,T1.Dscription,T1.Quantity, T1.Price, T1.LineTotal,T0.DocEntry,T1.DocEntry,T1.LineNum,T2.LineNum
    B1 don't like brackets!
    Regards

  • Oracle SQL query for getting specific special characters from a table

    Hi all,
    This is my table
    Table Name- Table1
    S.no    Name
    1          aaaaaaaa
    2          a1234sgjghb
    3          a@3$%jkhkjn
    4          abcd-dfghjik
    5          bbvxzckvbzxcv&^%#
    6          ashgweqfg/gfjwgefj////
    7          sdsaf$([]:'
    8          <-fdsjgbdfsg
    9           dfgfdgfd"uodf
    10         aaaa  bbbbz#$
    11         cccc dddd-/mnm
    The output has to be
    S.no    Name
    3          a@3$%jkhkjn
    5          bbvxzckvbzxcv&^%#
    7          sdsaf$([]:'
    8          <-fdsjgbdfsg
    10         aaaa  bbbbz#$
    It has to return "Name" column which is having special characters,whereas some special chars like -, / ," and space are acceptable.
    The Oracle query has to print columns having special characters excluding -,/," and space
    Can anyone help me to get a SQL query for the above.
    Thanks in advance.

    You can achieve it in multiple ways. Here are few.
    SQL> with t
      2  as
      3  (
      4  select 1 id, 'aaaaaaaa' name from dual union all
      5  select 2 id, 'a1234sgjghb' name from dual union all
      6  select 3 id, 'a@3$%jkhkjn' name from dual union all
      7  select 4 id, 'abcd-dfghjik' name from dual union all
      8  select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
      9  select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
    10  select 7 id, 'sdsaf$([]:''' name from dual union all
    11  select 8 id, '<-fdsjgbdfsg' name from dual union all
    12  select 9 id, 'dfgfdgfd"uodf' name from dual union all
    13  select 10 id, 'aaaa  bbbbz#$' name from dual union all
    14  select 11 id, 'cccc dddd-/mnm' name from dual
    15  )
    16  select *
    17    from t
    18   where regexp_like(translate(name,'a-/" ','a'), '[^[:alnum:]]');
            ID NAME
             3 a@3$%jkhkjn
             5 bbvxzckvbzxcv&^%#
             7 sdsaf$([]:'
             8 <-fdsjgbdfsg
            10 aaaa  bbbbz#$
    SQL> with t
      2  as
      3  (
      4  select 1 id, 'aaaaaaaa' name from dual union all
      5  select 2 id, 'a1234sgjghb' name from dual union all
      6  select 3 id, 'a@3$%jkhkjn' name from dual union all
      7  select 4 id, 'abcd-dfghjik' name from dual union all
      8  select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
      9  select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
    10  select 7 id, 'sdsaf$([]:''' name from dual union all
    11  select 8 id, '<-fdsjgbdfsg' name from dual union all
    12  select 9 id, 'dfgfdgfd"uodf' name from dual union all
    13  select 10 id, 'aaaa  bbbbz#$' name from dual union all
    14  select 11 id, 'cccc dddd-/mnm' name from dual
    15  )
    16  select *
    17    from t
    18   where translate
    19         (
    20            lower(translate(name,'a-/" ','a'))
    21          , '.0123456789abcdefghijklmnopqrstuvwxyz'
    22          , '.'
    23         ) is not null;
            ID NAME
             3 a@3$%jkhkjn
             5 bbvxzckvbzxcv&^%#
             7 sdsaf$([]:'
             8 <-fdsjgbdfsg
            10 aaaa  bbbbz#$
    SQL>

  • Handling sql query in jsp while extracing records from 3 tables

    hi to one and all,
    i want to implement the sql query given below in jsp in execute query statement . the query is working in sql but not when implemented using jsp. please help me in resolving this.
    Query
    SELECT e.Department , e.ETitle , s.basic , s.da, c.address1 , c.address2 from Employee e , Salary s , Contactdetails1 c where e.id = s.id and e.id =c.id

    It would help if you gave us a little more info to go on like;
    a) post your code
    b) post the error message the compiler is giving you

  • SQL Query takes 7 hours after upgrade to 10g

    the following query executes in under a minute in 9i, however once upgraded to 10g it takes 7 hours. The query is designed to select the data row with the max date value for the selected criteria (there are multiple rows that match the below criteria with different dates)
    I have tested in a lower environment the setting of "_optimizer_cost_based_transformation"=off and this corrects the problem. I do not feel comfortable setting this parameter session or system wide to provide a solution
    We are running Oracle 10gR2 on Solaris
    select "INSTN_ID_N",
    "MEAS_D",
    "FEED_TYPE_C",
    "FREQ_C",
    "STAT_LVL_C",
    "TS_D",
    "IX_INSTN_ID_C",
    "ENTI_TYPE_C",
    "CNTXT_ID_C",
    "CNTXT_C",
    "IX_CNTXT_ID_C",
    "VND_C",
    "PRCS_C",
    "USR_ID_C",
    "STAT_C",
    "OVRD_RSN_C",
    "LD_DT_D",
    "UPD_USR_C",
    "UPD_TS_D",
    "INS_USR_C",
    "INS_TS_D",
    "DEL_FLG_C"
    from IDA.V_INSTANCE_STATUS M
    where
    TS_D =
    select max (TS_D) from IDA.V_INSTANCE_STATUS
    where
    INSTN_ID_N = M.INSTN_ID_N AND
    MEAS_D = M.MEAS_D AND
    FEED_TYPE_C = M.FEED_TYPE_C AND
    FREQ_C = M.FREQ_C AND
    STAT_LVL_C = M.STAT_LVL_C AND
    IX_INSTN_ID_C = M.IX_INSTN_ID_C
    )

    user638113 wrote:
    the following query executes in under a minute in 9i, however once upgraded to 10g it takes 7 hours. The query is designed to select the data row with the max date value for the selected criteria (there are multiple rows that match the below criteria with different dates)
    I have tested in a lower environment the setting of "_optimizer_cost_based_transformation"=off and this corrects the problem. I do not feel comfortable setting this parameter session or system wide to provide a solutionIf you're sure that the "lower" environment reproduces the same issue, and not due to some other differences (different statistics, parameters etc.), then you could share the two different execution plans generated via DBMS_XPLAN.DISPLAY having the cost based transformations turned on and off. Make sure you use the \ tags before and after the plan output to format it in fixed font. You can use the "Quote" button in the message editor to see how to use the tag.
    Furthermore a optimizer trace (10053) might reveal why the cost based transformations lead to such an result.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Navigational Attribute Clarification

    Hi all, I have gone  thru the forum for this concept. Still i have little bit confusion on this. Wat i understood is, Nav Attr behaves like a characterstic in Reporting, wat my doubt is instead of creating Nav Attr why don't we go for Creating that a

  • E52 slow running - freeze - automatic restart

    Hello I have since one month a E52. Since last week I notice some time slow running or even no response then I am using the phone. If I press then for long time the home button all open programs are shown but also some strange entries these are: -Mai

  • Photoshop CS6 Slow Performance

    Hi guys, Wonder if you can help me with this one. I've noticed recently my copy of CS6 has become very slow and laggy. Symptoms: Unresponsive Repeated messages about "Out of memory" GUI unresponsive, everything goes grey Temp Fix: I've messed around

  • Where does Network Manager get its "secrets?"

    I am experimenting with PEAP authentication on a wireless network via Network Manager, and in the NM logs (journalctl -u NetworkManager), I keep seeing a line like this one: Sep 11 10:56:26 anchor NetworkManager[1300]: <info> Activation (wlp2s0/wirel

  • Aperture on it's last legs?

    I have been having increasing problems with aperture, i use it at my work to archive several thousand photos per month, and its been getting increasingly slow and unreliable, I've posted previously regarding other problems, but now ive hit a big one: