Issue with Join in query?

Hi All,
I have a query report for sales which is giving multiple data if the invoice is based on multiple sales order i.e 2 SO copied to 1 delivery and 1 delivery copied to single invoice.
SELECT DISTINCT concat(T13.BeginStr,right(T7.DOCNUM,6)) AS ' INVOICE No.',T7.DocDate as 'Invoice Date',T7.DocDueDate,
T1.DocNum ,T1.DocDate'DocDate',T7.CardCode as 'Customer Code',  T7.CARDNAME as 'Customer Name',T7.U_otherref
,T3.DocNum As ' DC Ref#',
T3.DocDate as 'DC Date',
T7.SHIPTOCODE as 'Ship To Code',T6.Linenum,T6.ITEMCODE,T6.DSCRIPTION,T6.U_SaleType,T6.U_SpclDeal, cast(T15.UserText as VarChar) as 'Item Remarks',
T6.QUANTITY,T6.WhsCode as 'Wh Name',T6.UnitMsr as 'UoM',T6.PriceBefDi as 'Basic Price',
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=1 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )VAT,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=7 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )Surcharge,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=18 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )AddVat,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=8 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )EntryTax,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=4 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )CST,
T7.NUMATCARD as 'Customer PO No.'
FROM        
                     dbo.RDR1 T0 left  JOIN
                      dbo.ORDR T1 ON T1.DocEntry = T0.DocEntry  LEFT JOIN
                      dbo.DLN1 T2 ON T2.BaseEntry = T1.DocEntry LEFT JOIN
                      dbo.ODLN T3 ON T2.DocEntry = T3.DocEntry  left JOIN
                      dbo.INV1 T6 ON T6.BaseEntry = T3.DocEntry LEFT outer JOIN
                      dbo.OINV T7 ON T7.DocEntry = T6.DocEntry  LEFT JOIN
                      dbo.OITM T15 ON T15.ItemCode = T6.ItemCode  LEFT JOIN
                      dbo.OSLP T8 on T1.SLPCode = T8.SlpCode    LEFT JOIN
                      dbo.OHEM T9 on T1.OwnerCode = T9.empID    LEFT JOIN
                      dbo.INV12 T10 on T7.Docentry = T10.DocEntry LEFT JOIN
   dbo.OCRD T12 on T7.CardCode = T12.CardCode LEFT JOIN
   NNM1 T13 ON T7.Series = T13.Series left join
   OITB T14 on T14.ItmsGrpCod = T15.ItmsGrpCod
WHERE T6.BaseType = '15'  and T7.Doctype = 'I' --and T7.docnum = '46000138'
Can someone please let me know which join is wrong here that its fetching multiple lines?
Thanks,
Joseph

Hi Joseph,
Try this query without UDF:
SELECT DISTINCT T7.DOCNUM AS ' INVOICE No.',T7.DocDate as 'Invoice Date',T7.DocDueDate,
T1.DocNum ,T1.DocDate'DocDate',T7.CardCode as 'Customer Code',  T7.CARDNAME as 'Customer Name'
,T3.DocNum As ' DC Ref#',
T3.DocDate as 'DC Date',
T7.SHIPTOCODE as 'Ship To Code',T6.Linenum,T6.ITEMCODE,T6.DSCRIPTION, cast(T15.UserText as VarChar) as 'Item Remarks',
T6.QUANTITY,T6.WhsCode as 'Wh Name',T6.UnitMsr as 'UoM',T6.PriceBefDi as 'Basic Price',
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=1 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )VAT,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=7 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )Surcharge,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=18 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )AddVat,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=8 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )EntryTax,
(Select distinct isnull(Sum(INV4.taxsum),0) from INV4 where INV4.statype=4 and INV4.docentry=T7.Docentry and INV4.linenum = T6.Linenum )CST,
T7.NUMATCARD as 'Customer PO No.'
FROM        
                     dbo.RDR1 T0 left  JOIN
                      dbo.ORDR T1 ON T1.DocEntry = T0.DocEntry  LEFT JOIN
                      dbo.DLN1 T2 ON T2.BaseEntry = T1.DocEntry and T2.[BaseLine] = T0.[LineNum] LEFT JOIN
                      dbo.ODLN T3 ON T2.DocEntry = T3.DocEntry  left JOIN
                      dbo.INV1 T6 ON T6.BaseEntry = T3.DocEntry and T6.[BaseLine] = T2.[LineNum]LEFT outer JOIN
                      dbo.OINV T7 ON T7.DocEntry = T6.DocEntry  LEFT JOIN
                      dbo.OITM T15 ON T15.ItemCode = T6.ItemCode  LEFT JOIN
                      dbo.OSLP T8 on T1.SLPCode = T8.SlpCode    LEFT JOIN
                      dbo.OHEM T9 on T1.OwnerCode = T9.empID    LEFT JOIN
                      dbo.INV12 T10 on T7.Docentry = T10.DocEntry LEFT JOIN
   dbo.OCRD T12 on T7.CardCode = T12.CardCode LEFT JOIN
   NNM1 T13 ON T7.Series = T13.Series left join
   OITB T14 on T14.ItmsGrpCod = T15.ItmsGrpCod
WHERE T6.BaseType = '15'  and T7.Doctype = 'I' and T7.docnum = [%0]
Thanks & Regards,
Nagarajan

Similar Messages

  • Issue with Join query

    Question 1:
    I have run into an issue of join between the two tables.
    There are two tables named a and b with the following descriptions -
    desc a
    Name Null Type
    STORE_NUMBER NOT NULL CHAR(9)
    ASSORTMENT_NUMBER NOT NULL CHAR(9)
    ITEM_NUMBER NOT NULL CHAR(9)
    DESCRIPTION CHAR(1000)
    UPC_CODE NOT NULL CHAR(15)
    STOCK_FLAG CHAR(1)
    AVG_RTL_PRICE CHAR(16)
    SALES_MOVEMENT CHAR(16)
    PROD_STYLE CHAR(50)
    COLOR CHAR(50)
    ATT_1 CHAR(50)
    ATT_2 CHAR(50)
    ATT_3 CHAR(50)
    ATT_4 CHAR(50)
    ATT_5 CHAR(50)
    ATT_6 CHAR(50)
    ATT_7 CHAR(50)
    ATT_8 CHAR(50)
    ATT_9 CHAR(50)
    ATT_10 CHAR(50)
    ATT_11 CHAR(50)
    ATT_12 CHAR(50)
    ATT_13 CHAR(50)
    ATT_14 CHAR(50)
    ATT_15 CHAR(50)
    25 rows selected
    desc b
    Name Null Type
    ASSORTMENT_NUMBER NOT NULL CHAR(9)
    ITEM_NUMBER NOT NULL CHAR(9)
    MERCH_METHOD NOT NULL VARCHAR2(15)
    UPC_CODE NOT NULL CHAR(15)
    MODEL_NUMBER CHAR(50)
    HEIGHT CHAR(10)
    WIDTH CHAR(10)
    DEPTH CHAR(10)
    IMAGE_FILE_NAME CHAR(500)
    LINESHAPE_FILE_NAME CHAR(500)
    IPU CHAR(10)
    ASSORTMENT_NAME VARCHAR2(100)
    12 rows selected
    There are 23094 records for assortment_number 16370 in the table a and 123 records in the table b.
    But, when I run the below query using matching assortment number and upc code, its returning more than 2.5 million records. Why is it doing a product?
    select
    a.store_number,
    a.assortment_number,
    a.item_number,
    a.description,
    a.upc_code,
    a.avg_rtl_price,
    a.sales_movement,
    b.height,
    b.width,
    b.depth,
    b.merch_method,
    b.model_number,
    b.ipu,
    b.assortment_name
    from a,
    b
    where
    ltrim(trim(a.assortment_number),0) = ltrim(trim(b.assortment_number),0)
    and ltrim(trim(a.assortment_number),0) = ‘16370’
    and
    ltrim(trim(b.upc_code),0) = ltrim(trim(b.upc_code),0);
    Question 2 -
    Can I break the query down by store numbers from both the tables and extract them to separate files by store numbers?
    Appreciate your inputs. Thanks in advance.

    853720 wrote:
    But how do I fix my query so as to return not the product of the two tables but only the unique matching records based on assortment_number and upc_code ?And what is "unique matching record" Based on table B each assortment has multiple items. So it looks like table B uniqueness is on assortment_number, item_number. So question is what is column upc_code? Is it assortment upc or item upc? If it is not item upc - you got your unswer. Actually, I just noticed:
    ltrim(trim(<font size=4 color=red>b</font>.upc_code),0) = ltrim(trim(<font size=4 color=red>b</font>.upc_code),0);It should be:
    ltrim(trim(<font size=4 color=red>a</font>.upc_code),0) = ltrim(trim(<font size=4 color=red>b</font>.upc_code),0);SY.
    P.S. I am not questioning column datatypes at this point, but they obviously indicate bad design. You should at least use VARCHAR2 instead of CHAR.

  • Query report issue with Joins

    HI Everyone,
    I'm facing a issue with SQ02, where I need to link 2 table COVP and AFRU . Now that I have 2 feilds in COVP REFBN and AWORG which is or Char(10) feilds and I need to link this with tabl;e AFRU feilds RUECK and RMZHL which is of Num(10) and Num(4).
    I cant use a join link between these 2 feilds as it says illegal join. Now I need to pull data by the input from COVP that of refbn and aworg.
    Please let me know how to go about and implement this? Is there a way where I can use the code section and write code for this. I need to further add another table CATSDB from the output from AFRU.
    Thanks & Best regards,
    Raj

    Hi Raj,
    I had the same problem with other join, since the two fields are different it is not possible to use a join on them.
    The only solution that occurred to me was to create an auxiliary table to map both fields with all possible values, like this:
    | fild1 | field2  |
    |   001   | 00001 |
    |   002   | 00002 |
    And a view with one of the tables together with this auxiliary one. Then the join would use this view...
    I admit it isn't pretty, but it would work. However in the end I've decided to write a program instead of using a query to obtain our client's desired map.
    best regards,
    Edgar

  • Performance issue with joins on table VBAK, VBEP, VBKD and VBAP

    hi all,
    i have a report where there is a join on all 4 tables VBAK, VBEP, VBKD and VBAP.
    the report is giving performance issues because of this join.
    all the key fields are used for the joining of tables. but some of the non-key fields like vbap-vstel, vbap-abgru and vbep-wadat are also part of select query and are getting filled.
    because of these there is a performance issue.
    is there any way i can improve the performance of the join select query?
    i am trying "for all entries" clause...
    kindly provide any alternative if possible.
    thanks.

    Hi,
    Pls perform some of the below steps as applicable for the performance improvement:
    a) Remove join on all the tables and put joins only on header and item (VBAK & VBAP).
    b) code should have separate select for VBEP and VBKD.
    c) remove the non key fields from the where clause. Once you retrieve data from the database into the internal table, sort the table and delete the entries which are not part of the non-key fields like vstel, abgru and wadat.
    d) last option is you can create index in the VBAP & VBEP table with respect to the fields vstel, abgru & wadat ( not advisable)
    e) buffering option on database tables also possible.
    f) select only the fields into the internal table that are applicable for the processing logic and also the select query should contaian the field names in the same order as mentioned in the database table.
    Hope this helps.
    Regards
    JLN

  • Performance issue with the Select query

    Hi,
    I have an issue with the performance with a seclet query.
    In table AFRU - AUFNR is not a key field.
    So i had selected the low and high values into s_reuck and used it in Where condition.
    Still i have an issue with the Performance.
    SELECT SINGLE RUECK
    RMZHL
    IEDD
    AUFNR
    STOKZ
    STZHL
    FROM AFRU INTO table t_AFRU
    FOR ALL ENTRIES IN T_ZSCPRT100
    WHERE RUECK IN S_RUECK AND
    AUFNR = T_ZSCPRT100-AUFNR AND
    STOKZ = SPACE AND
    STZHL = 0.
    I had also cheked by createing an index for AUFNR in the table AFRU...it does not help.
    Is there anyway that we can declare Key field while declaring the Internal table....?
    ANy suggestions to fix the performance issue is apprecaited!
    Regards,
    Kittu

    Hi,
    Thank you for your quick response!
    Rui dantas, i have lill confusion...this is my code below :
    data : t_zscprt type standard table of ty_zscprt,
           wa_zscprt type ty_zscprt.
    types : BEGIN OF ty_zscprt100,
            aufnr type zscprt100-aufnr,
            posnr  type zscprt100-posnr,
            ezclose type zscprt100-ezclose,
            serialnr type zscprt100-serialnr,
            lgort type zscprt100-lgort,
          END OF ty_zscprt100.
    data : t_zscprt100 type standard table of ty_zscprt100,
           wa_zscprt100 type ty_zscprt100.
    Types: begin of ty_afru,
                rueck type CO_RUECK,
                rmzhl type CO_RMZHL,
                iedd  type RU_IEDD,
                aufnr type AUFNR,
                stokz type CO_STOKZ,
                stzhl type CO_STZHL,
             end of ty_afru.
    data : t_afru type STANDARD TABLE OF ty_afru,
            WA_AFRU TYPE TY_AFRU.
    SELECT AUFNR
            POSNR
            EZCLOSE
            SERIALNR
            LGORT
            FROM ZSCPRT100 INTO TABLE T_ZSCPRT100
            FOR ALL ENTRIES IN T_ZSCPRT
            WHERE   AUFNR = T_ZSCPRT-PRTNUM
            AND   SERIALNR IN S_SERIAL
            AND    LGORT   IN S_LGORT.
        IF sy-subrc <> 0.
           MESSAGE ID 'Z2' TYPE 'I' NUMBER '41'. "BDCG87
           stop."BDCG87
        ENDIF.
      ENDIF.
    SELECT    RUECK
                  RMZHL
                  IEDD
                  AUFNR
                  STOKZ
                  STZHL
                  FROM AFRU INTO TABLE T_AFRU
                  FOR ALL ENTRIES IN T_ZSCPRT100
                  WHERE RUECK IN S_RUECK     AND
                        AUFNR = T_ZSCPRT100-AUFNR AND
                        STOKZ = SPACE AND
                        STZHL = 0.
    Using AUFNR, get AUFPL from AFKO
    Using AUFPL, get RUECK from AFVC
    Using RUEKC, read AFRU
    In other words, one select joining AFKO <-> AFVC <-> AFRU should get what you want.
    This is my select query, would you want me to write another select query to meet this criteria..
    From AUFNR> I will get AUFPL from AFKO> BAsed on AUFPL I will get RUECK, based on RUEKC i need to read AFRU..but i need to select few field from AFRu based on AUFNR....
    ANy suggestions wil be appreciated!
    Regards
    Kittu

  • Issue with Saving the Query output data in Excel format

    Hi,
    Recnetly we had upgraded from 4.6c to ECC 6.0.
    In ECc 6.0 environment, when user try to export the query output , we are getting only XML option to save the data.
    But user want to save the data in EXcel format, he was able to do that in 4.6C.
    pleas eprovide some inputs, on this issue.
    Thanks,
    Sanketh.

    I cannot for the life of me imagine, why a link to a post in the 'Business One Forum' where one uses ODBC to transfer query-data to MicroSoft Excel is of relevance to the OPs question, even if the same is not a security issue.
    Never mind. [note 40155|https://service.sap.com/sap/support/notes/402155] deals with various symptoms in the ALV-Excel combination as as of release 4.6C. There are various others, mostly in components BC-SRV-ALV and BC-ABA-LI - also: I remember that when we upgraded from 4.5B to 4.7C there was an issue with Excel-templates -> the solution was in the release notes somewhere. So, in addition to SMP you might want to check the release notes and/or upgrade guide for solutions.
    And yes, moderators ... this is not a security issue, this should go to ECC-Applications/Upgrade.

  • Issue with Joins in Complex Folder

    Hi,
    We have two problems when we include items into complex folders.
    1.
    Say, I have a folder FOLDER1 with joins to FOLDER2 and FOLDER3.
    Create a complex folder with items from folder2 and folder3.
    Include items fro folder1 - Now starts the problem. Discoverer is using join between folder1->folder2 to resolve the items in the complex folder. but i want it to use folder1->folder3. How can make sure it uses the other join?
    2.
    There are some folders included in the complex folder as components but we are not using any items from them anymore. How do I get rid of those components ? They are causing problems because of the joins between them and the real folders I want to use in the complex folder.

    Hi,
    If you have 2 base folders A and B, and you create a join between A and B then both folders will contain the A<->B join.
    If you then create a complex folder X and drag items from A into X. X will not contain the A<->B join. If you want to join X to B in your report then you will have to create a X<-> B join.
    However, if you drag items from both A and B into X, then folder X will implicitly contain the A<->B join. It won't show up in the folder items, but will be shown in the folder dependencies.
    Hope that helps,
    Rod West

  • Issue with join condition while using in the corelated sub query

    Bees,
    I am not able to use the below query since i have used a join condition in the corelated sub qery inline view.But i have a requirement like this . Please help me on this
    select * from dept d
    where exists (select 1 from (
    select deptno
    from emp where deptno= d.deptno)
    Thank you
    Boooo

    Hi,
    I've never seen a general solution for how to reference columns from main query a from sub-query c, where c is is sub-query of b, which is a sub-query of a.
    Whenever I've wanted to, I've been able to get the desired results with a different approach.
    In this case, you seem to want
    SELECT     *
    FROM     dept     d
    WHERE     EXISTS     (
              SELECT     1
              FROM     emp
              WHERE     deptno     = d.deptno
              );I'm guessing at your data and desired output.

  • Issue with Input Ready Query in Integrated Planning.

    Hello Everyone,
                                I've been working on Integrated Planning for some time now. My company recently started using a new server for this work. I find that I am unable to make the queries "input ready". Though I edited the properties of the key figure to "accept user entered values" and chose the option to "start query in change mode", when I execute the query, I find that it the values for the Key Figure cannot be changed. I tried to search in the OSS for any note(s) regarding this issue, but was unable to come up with a solution. Is the problem related to the server or is there some other configuration that I should take care of? Additionally, I would also like to know if there is any method to debug such a problem. I would appreciate it if someone could help me out in this regard.
    Thanks,
    Jake.

    Hi,
    Please verify the following.
    1. Check if the underlying realtime cube is in "Planning Mode:Loading not allowed" state in rsa1
    2. If you have created an aggregation level, Check if the most detailed information is available at that Aggregation Level(i.e, include characteristics so that the record can be uniquely identified at that aggregation level).Best would be to include all characteristics and create a query first and ensure it works.Then remove unwanted charecteristics one by one, so that you can fix the issue.Best thing to start with is to create the aggregation level on top the real time cube itself.
    3. Check for any characteristic restrictions been defined for the real-time cubes.If so, try removing them temporarily and execute the query
    4.Also check if any data slices has been created on the real time cube. If so, try removing it temporarily and then execute the query.
    5. Set the property for Planning "Start query in Change Mode"- this is for th Query
    6. Set the 'Key Figure' Planning Property to "Can be changed Manually or via Planning Functions" for the appropriate KeyFigures- this is for the key figures
    7. Try removing the currency/unit from row/column. Try restricting them in filters rather than in row/columns.
    8. Check if there are any locks occurring due to filter., i.e if you are using a filter and even if 1 record of this selection locks with another user's selection you lose the input readiness.
    Mostly this should fix the issue. Assign points if this info helps you.
    Thanks,
    Balaji.

  • Performance issue with this complex query

    Please ignore this thread(post)
    This query fetches a lot of data and takes more than 4 t0 5 hrs to retrieve them.
    I have tried to get the explain plan the display cursor and the TKPROF for the same but then the query utilizes more than 100GB temp space and it fails to generate any.
    What I have is the spool file which is pasted below along with the query.
    Database version: 11g
    I'm looking forward for suggestions how to improve the performance of this statement
    Please ignore this thread(post)
    Edited by: user13319084 on May 30, 2011 12:34 AM

    You provide no information that can be used in answering your question on how to improve the query.
    In absence of technical information, all that we can discuss is conceptual issues. Like why is the query that complex? A common answer is that the underlying data model lacks the intelligence and this now requires the intelligence to be build into the query.
    You need to look at the data model and the query in order to address this performance problem - and make sure that the actual business requirements is clearly identified and understood.

  • Performance issue with a particular query

    Hi Experts,
    OS version : Sun solaris 5.10
    DB version : 10.1.0.4
    We have a report designed in SAP BO and for which we have below SQL query written
    SELECT
    SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER,
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_NAME
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_DOMAIN_NAME
    Count(DISTINCT SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER),
    Count(DISTINCT case when SNOW_DIM.SERV_REP_INCIDENT.STATE_ID=3 then SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER end),
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP,
    case when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=1 then 'Level 1' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=2 then 'Level 2' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=3 then 'Level 3' else to_char(SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL) end,
    SNOW_DIM.SERV_REP_INCIDENT.SHORT_DESCRIPTION,
    SNOW_DIM.SERV_REP_INCIDENT.PRIORITY,
    SNOW_DIM.SERV_REP_INCIDENT.STATE,
    SNOW_DIM.SERV_REP_INCIDENT.OPENED_AT,
    BU_EMPLOYEES_INC_AS.BUSINESS_NAME,
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'Month'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'MM'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'SYYYY'),
    SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT
    FROM
    SNOW_DIM.SERV_REP_INCIDENT,
    SNOW_DIM.ISAC_GL_APPL_HIERARCHY ISAC_GL_APPL_HIERARCHY_SERVIMP,
    SNOW_DIM.BU_EMPLOYEES BU_EMPLOYEES_INC_AS,
    SNOW_DIM.SERV_REP_CONTRACT_SLA,
    SNOW_DIM.SERV_REP_TASK_SLA
    WHERE
    ( SNOW_DIM.SERV_REP_INCIDENT.ASSIGNEE_GPN=BU_EMPLOYEES_INC_AS.GPN(+) )
    AND ( SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_SYS_ID=SNOW_DIM.SERV_REP_TASK_SLA.TASK(+) )
    AND ( SNOW_DIM.SERV_REP_TASK_SLA.SLA=SNOW_DIM.SERV_REP_CONTRACT_SLA.SYS_ID(+) )
    AND ( ISAC_GL_APPL_HIERARCHY_SERVIMP.APPL_ID(+)=SNOW_DIM.SERV_REP_INCIDENT.SERVICE_ID )
    AND
    ISAC_GL_APPL_HIERARCHY_SERVIMP.APPL_ENVIRONMENT
    = 'PROD'
    AND
    SNOW_DIM.SERV_REP_INCIDENT.TYPE_X = 'Incident'
    AND
    case
    WHEN SNOW_DIM.SERV_REP_INCIDENT.DUPLICATE_INCIDENT = 1 then 'Yes'
    WHEN SNOW_DIM.SERV_REP_INCIDENT.DUPLICATE_INCIDENT = 0 then 'No'
    end = 'No'
    AND
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP IN ( 'WMSB_IT_CH_Business_Support_1_L2','WMSB_IT_CH_Business_Support_2_HW_L2','WMSB_IT_CH_Business_Support_2_L2','WMSB_IT_CH_Business_Support_3_L2','WMSB_IT_CH_Business_Support_4_CEFS_L2','WMSB_IT_CH_Business_Support_4_L2','WMSB_IT_CH_Business_Support_5_L2','WMSB_IT_APAC_Production_Support_L2','WMSB_IT_EMEA_ESS_CLAS_Team_L2','WMSB_IT_US_Production_Support_L2','WMSB_IT_CH_AoC_Decentral_L2','WMSB_IT_CH_AoC_Mainframe_L2','WMSB_IT_GLOB_AoC_Decentral_L2' )
    OR
    SNOW_DIM.SERV_REP_CONTRACT_SLA.TYPE_X = 'SLA'
    AND
    SNOW_DIM.SERV_REP_TASK_SLA.STAGE IN ( 'in_progress','achieved','breached','completed','paused' )
    OR
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP NOT IN ( 'WMSB_IT_CH_Business_Support_1_L2','WMSB_IT_CH_Business_Support_2_HW_L2','WMSB_IT_CH_Business_Support_2_L2','WMSB_IT_CH_Business_Support_3_L2','WMSB_IT_CH_Business_Support_4_CEFS_L2','WMSB_IT_CH_Business_Support_4_L2','WMSB_IT_CH_Business_Support_5_L2','WMSB_IT_APAC_Production_Support_L2','WMSB_IT_EMEA_ESS_CLAS_Team_L2','WMSB_IT_US_Production_Support_L2','WMSB_IT_CH_AoC_Decentral_L2','WMSB_IT_CH_AoC_Mainframe_L2','WMSB_IT_GLOB_AoC_Decentral_L2','WMSB_IT_GLOB_Service_Desk_L1','WMSB_IT_EMEA_ESS_CLAS_Team_L1' )
    AND
    SNOW_DIM.SERV_REP_TASK_SLA.ASSIGNMENT_GROUP_NAME IN ( 'WMSB_IT_CH_Business_Support_1_L2','WMSB_IT_CH_Business_Support_2_HW_L2','WMSB_IT_CH_Business_Support_2_L2','WMSB_IT_CH_Business_Support_3_L2','WMSB_IT_CH_Business_Support_4_CEFS_L2','WMSB_IT_CH_Business_Support_4_L2','WMSB_IT_CH_Business_Support_5_L2','WMSB_IT_APAC_Production_Support_L2','WMSB_IT_EMEA_ESS_CLAS_Team_L2','WMSB_IT_US_Production_Support_L2','WMSB_IT_CH_AoC_Decentral_L2','WMSB_IT_CH_AoC_Mainframe_L2','WMSB_IT_GLOB_AoC_Decentral_L2' )
    AND
    SNOW_DIM.SERV_REP_TASK_SLA.STAGE IN ( 'in_progress','achieved','breached','completed','paused' )
    AND
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_DOMAIN_NAME
    IN ('Partner, Product & Contract Management')
    AND
    SNOW_DIM.SERV_REP_INCIDENT.STATE IN ( 'Assigned','Closed','In Progress','New','On Hold','Resolved' )
    AND
    ( ( SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT ) between (ADD_MONTHS(trunc(sysdate,'MM'),-6)) AND (trunc(sysdate,'MM')-0.0002/24)
    GROUP BY
    SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER,
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_NAME
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_DOMAIN_NAME
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP,
    case when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=1 then 'Level 1' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=2 then 'Level 2' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=3 then 'Level 3' else to_char(SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL) end,
    SNOW_DIM.SERV_REP_INCIDENT.SHORT_DESCRIPTION,
    SNOW_DIM.SERV_REP_INCIDENT.PRIORITY,
    SNOW_DIM.SERV_REP_INCIDENT.STATE,
    SNOW_DIM.SERV_REP_INCIDENT.OPENED_AT,
    BU_EMPLOYEES_INC_AS.BUSINESS_NAME,
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'Month'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'MM'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'SYYYY'),
    SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT;
    Users reporting that the report is running slow and I have generated explain plan for the same and it is as below
    PLAN_TABLE_OUTPUT
    Plan hash value: 2068297582
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 13216 | 38M| | 245K (1)| 00:13:02 |
    | 1 | SORT GROUP BY | | 13216 | 38M| 103M| 245K (1)| 00:13:02 |
    |* 2 | FILTER | | | | | | |
    | 3 | NESTED LOOPS OUTER | | 13216 | 38M| | 232K (1)| 00:12:21 |
    |* 4 | FILTER | | | | | | |
    | 5 | NESTED LOOPS OUTER | | 508 | 1495K| | 232K (1)| 00:12:21 |
    |* 6 | FILTER | | | | | | |
    | 7 | NESTED LOOPS OUTER | | 508 | 1477K| | 232K (1)| 00:12:21 |
    |* 8 | HASH JOIN | | 96 | 270K| | 232K (1)| 00:12:21 |
    |* 9 | MAT_VIEW ACCESS FULL | ISAC_GL_APPL_HIERARCHY | 6 | 4230 | | 3884 (1)| 00:00:13 |
    |* 10 | TABLE ACCESS BY INDEX ROWID| SERV_REP_INCIDENT | 802K| 1669M| | 228K (1)| 00:12:08 |
    |* 11 | INDEX RANGE SCAN | I7_SERV_REP_INCIDENT_N | 1368K| | | 3437 (3)| 00:00:11 |
    | 12 | TABLE ACCESS BY INDEX ROWID | SERV_REP_TASK_SLA | 5 | 455 | | 1 (0)| 00:00:01 |
    |* 13 | INDEX RANGE SCAN | I6_SERV_REP_TASK_SLA | 5 | | | 0 (0)| 00:00:01 |
    | 14 | TABLE ACCESS BY INDEX ROWID | SERV_REP_CONTRACT_SLA | 1 | 37 | | 1 (0)| 00:00:01 |
    |* 15 | INDEX RANGE SCAN | I1_SERV_REP_CONTRACT_SLA | 1 | | | 0 (0)| 00:00:01 |
    | 16 | TABLE ACCESS BY INDEX ROWID | BU_EMPLOYEES | 26 | 858 | | 1 (0)| 00:00:01 |
    |* 17 | INDEX RANGE SCAN | I01_BU_EMPLOYEES | 26 | | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter(ADD_MONTHS(TRUNC(SYSDATE@!,'fmmm'),-6)<=TRUNC(SYSDATE@!,'fmmm')-.000011574074074074074074074074074
    07407407407)
    4 - filter("SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_APAC_Production_Support_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_AoC_Decentral_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_AoC_Mainframe_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_1_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_2_HW_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_2_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_3_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_4_CEFS_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_4_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_5_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_EMEA_ESS_CLAS_Team_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_GLOB_AoC_Decentral_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_US_Production_Support_L2' OR "T"."TYPE_X"='SLA' AND
    ("SERV_REP_TASK_SLA"."STAGE"='achieved' OR "SERV_REP_TASK_SLA"."STAGE"='breached' OR
    "SERV_REP_TASK_SLA"."STAGE"='completed' OR "SERV_REP_TASK_SLA"."STAGE"='in_progress' OR
    "SERV_REP_TASK_SLA"."STAGE"='paused') OR ("SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_APAC_Production_S
    upport_L2' OR "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_AoC_Decentral_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_AoC_Mainframe_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_1_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_2_HW_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_2_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_3_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_4_CEFS_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_4_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_5_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_EMEA_ESS_CLAS_Team_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_GLOB_AoC_Decentral_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_US_Production_Support_L2') AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_1_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_2_HW_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_2_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_3_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_4_CEFS_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_4_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_5_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_APAC_Production_Support_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_EMEA_ESS_CLAS_Team_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_US_Production_Support_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_AoC_Decentral_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_AoC_Mainframe_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_GLOB_AoC_Decentral_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_GLOB_Service_Desk_L1' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_EMEA_ESS_CLAS_Team_L1')
    6 - filter("SERV_REP_TASK_SLA"."STAGE"='achieved' OR "SERV_REP_TASK_SLA"."STAGE"='breached' OR
    "SERV_REP_TASK_SLA"."STAGE"='completed' OR "SERV_REP_TASK_SLA"."STAGE"='in_progress' OR
    "SERV_REP_TASK_SLA"."STAGE"='paused')
    8 - access("ISAC_GL_APPL_HIERARCHY_SERVIMP"."APPL_ID"="SERV_REP_INCIDENT"."SERVICE_ID")
    9 - filter("ISAC_GL_APPL_HIERARCHY_SERVIMP"."APPL_ENVIRONMENT"='PROD' AND
    "ISAC_GL_APPL_HIERARCHY_SERVIMP"."SOL_DOMAIN_NAME"='Partner, Product & Contract Management')
    10 - filter("SERV_REP_INCIDENT"."TYPE_X"='Incident' AND ("SERV_REP_INCIDENT"."STATE"='Assigned' OR
    "SERV_REP_INCIDENT"."STATE"='Closed' OR "SERV_REP_INCIDENT"."STATE"='In Progress' OR
    "SERV_REP_INCIDENT"."STATE"='New' OR "SERV_REP_INCIDENT"."STATE"='On Hold' OR
    "SERV_REP_INCIDENT"."STATE"='Resolved') AND CASE "SERV_REP_INCIDENT"."DUPLICATE_INCIDENT" WHEN 1 THEN 'Yes'
    WHEN 0 THEN 'No' END ='No')
    11 - access("SERV_REP_INCIDENT"."CLOSED_AT">=ADD_MONTHS(TRUNC(SYSDATE@!,'fmmm'),-6) AND
    "SERV_REP_INCIDENT"."CLOSED_AT"<=TRUNC(SYSDATE@!,'fmmm')-.00001157407407407407407407407407407407407407)
    13 - access("SERV_REP_INCIDENT"."INCIDENT_SYS_ID"="SERV_REP_TASK_SLA"."TASK"(+))
    15 - access("SERV_REP_TASK_SLA"."SLA"="T"."SYS_ID"(+))
    17 - access("SERV_REP_INCIDENT"."ASSIGNEE_GPN"="T"."GPN"(+))
    From above plan I could analyze that indexes on table SERV_REP_INCIDENT are not being used on columns ASSIGNED_GROUP, STATE, STAGE etc as they are using IN and NOT IN clauses in where condition and because of this reason cost at id 10 increased to 228k.
    now, i would like to know the advise from you people what can be done to make it better. also I read that IN clause can use indexes if data is more. In my case is there any way that I can force those IN and NOT IN clauses to use index? (we have indexes created on all those columns used by SERV_REP_INCIDENT table)
    Thanks in advance.

    From above plan I could analyze that indexes on table SERV_REP_INCIDENT are not being used on columns ASSIGNED_GROUP, STATE, STAGE etc as they are using IN and NOT IN clauses in where condition and >because of this reason cost at id 10 increased to 228k.Good job isolating the (estimated) spike in resources by high estimates! You can try to minimize the work for this step in several ways, some simple and some extreme:
    Try a composite function-based index on SERV_REP_INCIDENT for the IN clauses.
    Another long-term possiblity is to partition the SERV_REP_INCIDENT table by the IN values if you have the license. This may not be the best partionining option; partitioning needs to be conisdered carefully before implementation.
    How long does the query take to execute? Another possiblity is to to create a materialized view on the query you posted, using the automated query rewrite to automatically use it (possibly indexed).

  • Issue with one Select Query in  PBS Archive Translation Tool

    Hi All,
    Iam having X mark symbol against the select query from EKET table
    This is the select query in my actual program and when i convert this using PBS Archive Translation Tool i have a X mark against this select query
    SELECT SINGLE BANFN FROM EKET INTO V_BANFN WHERE EBELN = BSEG-EBELN AND
                                                      EBELP = BSEG-EBELP AND
                                                      ETENR = '0001'.
    I guess i have to modify this select query because EKET table has transaction data and we cannot ignore this X mark.
    Let me know if iam wrong
    ALso , iam confused whether a select query with X needs to fixed or can be ignored
    Thanks

    Hi ,
    Any Suggestions
    Thanks

  • Issue with condition in Query

    Hi,
    I have report on a cube which when  execute vit all main characteristics(highest level char[plant] to lowest level[material] chars) like plant, external-material grp, material type, project-plant and material the report vil come vit correct values , wen v remove the lowest level ie., material the overall result is changing.
         There is a condition for Godown Quantity(godown qty notequalto  0)
        Because of the condition on godown qty the overall result is changing.
    like:
    qty 61-120amt 61-120qty >120----amt >120
    10936.06-766957.91-1955762.54--725613332.2(overall-results)
    when we drill down are remove drill down any characteristic then some value(6422) of amt61-120 days  is shifting to amt>120days,this happening  also for qty.
    like:
    10934.66760535.291955763.94---725619755(overall-results)
        so i removed the condition and executed the report, here wat ever char v remove and wat ever char v drill down no effect to over all result means it vil remain unchange.
       But asking for no zero values for Godown quantity.
    Help me in this....
    Thanks in Advance,
    Chaitu.
    Edited by: chaithu218 on Jun 6, 2011 5:09 PM

    Hi,
    user555994 wrote:
    Hello Lee,
    thanks for your reply.
    But what is B?I think Lee meant to name the in-line view "B", like this:
    SELECT b.app_req_id
    FROM  (SELECT   a.app_req_id,
                    COUNT(*) cnt       -- or maybe COUNT (DISTINCT a.class_symbol)
           FROM     app_req a
           WHERE    a.class_symbol IN ('MBA', 'BTECH', 'BBA', 'SENIOR SECONDARY', 'SECONDARY')
           GROUP BY a.app_req_id)  b     -- Alias added here
    WHERE  b.cnt = 5
    ;You don't really need either alias. In fact, you don't need the sub-query: the query below is equivalent to the one above:
    SELECT    app_req_id
    FROM      app_req
    WHERE     class_symbol     IN ('MBA', 'BTECH', 'BBA', 'SENIOR SECONDARY', 'SECONDARY')
    GROUP BY  app_req_id
    HAVING    COUNT (*)           -- or maybe COUNT (DISTINCT class_symbol)
                     = 5
    ;If the combination (app_req_id, class_symbol) is not unique, then use "COUNT (DISTINT class_symbol)" instead of "COUNT (*)".
    There is only 1 table i am reffering to and need to get the ID where values matches in other column. Other column can have the values as that of MBA,BTECH,BBA,SENIOR SECONDARY and SECONDARY.
    I don't want to use query as -
    Select APP_REQ_ID FROM app_req where class_symbol in ('MBA', 'BTECH', 'BBA', 'SENIOR SECONDARY', 'SECONDARY')
    As this will be with either of the match found. I want where all of the match found.That's what the condition "WHERE b.cnt = 5" in the main query is for.
    >
    Kindly help.If the query above is not doing what you want, then post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data. Point out where the query above is getting the wrong results, and explain, with spoecific examples, how to get the right results in those places.

  • Issue with View object query

    Hi,
    I have extended my controller to add an additional condition to the view object query where I appen an add condition.If there is any kind of exception the add condition keeps on appending without refreshing the query to the orginal one.I have to clear the cache to be able to fix it
    below is the peice of code.What should I do to be able to get the original query or refresh it because when i do a getQuery it keeps giving me the query with the earlier condition that I appended and again appends the new condition.
    strQuery = oaviewobjectimpl.getQuery();
    oaviewobjectimpl.setQuery(strQuery+" AND MtlCategoriesKfv.CONCATENATED_SEGMENTS = '"+strCategory+"'");
    RequisitionAMImpl requisitionamimpl1 = (RequisitionAMImpl)oapagecontext.getApplicationModule(oawebbean);
    OAViewObjectImpl oaviewobjectimpl = requisitionamimpl.getReqCategoryVO();
    String strQuery = oaviewobjectimpl.getQuery();
    oaviewobjectimpl.setQuery(strQuery+" AND MtlCategoriesKfv.CONCATENATED_SEGMENTS = '"+strCategory+"'");
    oaviewobjectimpl.setWhereClauseParams(null);
    oaviewobjectimpl.setWhereClauseParam(0, oapagecontext.getCurrentLanguage());
    if(oapagecontext.isLoggingEnabled(1))
    oapagecontext.writeDiagnostics(this, "oaviewobjectimpl.getQuery() "+oaviewobjectimpl.getQuery(), 1);
    oaviewobjectimpl.executeQuery();
    oaviewobjectimpl.last();
    if(oapagecontext.isLoggingEnabled(1))
    oapagecontext.writeDiagnostics(this, "oaviewobjectimpl.getFetchedRowCount() "+oaviewobjectimpl.getFetchedRowCount(), 1);
    ReqCategoryVORowImpl reqcategoryvorowimpl= (ReqCategoryVORowImpl)oaviewobjectimpl.first();
    Number categoryId = reqcategoryvorowimpl.getCategoryId();

    user610276 ,
    Y don't u make a custom VO, as you are doing set query, i expect ur changing entire query of seeded VO, better to use custom VO here and attach it to required beans progrmatically.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Issue with "Select Distinct" query in Oracle 10g against Oracle 9i

    Hi,
    I would appreciate if some one help me here because it is really urgent.
    We are upgrading our database from 9i to 10g.
    There are the "Select distinct" queries in the code which populated the grid on the applications screens. We found a difference in 9i and 10g the way the result is populated for these queries. If "Select Distinct" query wihtout a order by clause is executed in 9i then the result is automatically sorted. But Oracle 10g does not do this.
    We can change the queries adding order by clause but we are almost at the end of the testing and want to know if there is any way that we can do this from database settings. Would there be any impact of these settings change on overall operation of Oracle 10g?
    I would appreciate if some one can help me here.
    Thanks,
    Dinesh

    then the result is automatically sorted.No. Oracle may have done a sort operation to perform the distinct, but it still did not guarantee the order of your results.
    In 10g and in 9i, if you want your results in a certain order you must use order by.

Maybe you are looking for