How to modify the query to get max id record

Hi All,
How to modify below query to get proper result.The query is returning some records are duplicated.I need only one record to display from duplicate based on max assetid.
Here is my query:
SELECT *
FROM (
SELECT a.uppertitle, a.composer, a.esongid,
MAX (asset_new.assetid) AS assetid,asset_new.ownerid
FROM (SELECT DISTINCT NVL (esong.title, '~') AS uppertitle,
INITCAP (NVL (esong.composer, '~')
) AS composer,
esong.esongid
FROM esong, esongcountry_us eus
WHERE 1 = 1
AND eus.esongid = esong.esongid
AND eus.isocountrycode IN ('US')
AND esong.title LIKE 'LIVE TO TELL%'
AND ROWNUM < 390) a,
songwebrecording,
recordingasset_new,
asset_new
WHERE a.esongid = songwebrecording.esongid(+)
AND songwebrecording.recordingid = recordingasset_new.recordingid(+)
AND recordingasset_new.assetid = asset_new.assetid(+)
GROUP BY a.uppertitle, a.composer, a.esongid,asset_new.ownerid)
WHERE ROWNUM <= 390
ORDER BY uppertitle
result:
     upperlittle composer esongid assetid onwerid
1.     LIVE TO TELL Gelb, Howe 480340000 null      null
2. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 null null
3. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3080366 null
4. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3038107 null
5. LIVE TO TELL THE TALE Holopainen 859841500 nulll nulll
I need the result like this :
     upperlittle composer esongid assetid onwerid
1.     LIVE TO TELL Gelb, Howe 480340000 null      null
2. LIVE TO TELL FROM THE Madonna (Ca)/ Leonard 125559900 3080366 null
3. LIVE TO TELL THE TALE Holopainen 859841500 nulll nulll
Please help me on this regard. oracle version is 9i
Regards,
Rajasekhar

can you please format your code with                                                                                                                                                                                                                        

Similar Messages

  • How to modify the query to get the output in a single row

    Hi All,
    Below is the query i have written it works fine
    select DISTINCT right(left(CTACCT,13),4) AS LocationNum,
    tODS_GLBalance.FiscalYearId AS FiscalYearId,
    tODS_GLBalance.FiscalMonthOfYearId AS FiscalMonthOfYearId,
    --tods_GLMetadata.Metric,
    Case when
    tods_GLMetadata.Metric = 'Gross Margin'
    Then SUM(Balance)
    Else 0
    END AS GrossMargin,
    Case when
    tods_GLMetadata.Metric = 'Occupancy'
    Then SUM(Balance)
    Else 0
    END AS Occupancy,
    Case when
    tods_GLMetadata.Metric = 'Payroll Dollars'
    Then SUM(Balance)
    Else 0
    END AS Payroll,
    Case when
    tods_GLMetadata.Metric = 'CF Sales'
    Then SUM(Balance)
    Else 0
    END AS OperatingSales,
    Case when
    tods_GLMetadata.Metric = 'Operations'
    Then SUM(Balance)
    Else 0
    END AS OperatingExpenses
    -- 0 as payroll
    from ods.[JJill].[tODS_GLBalance]
    inner join ods.Staging.tODS_INF_GLPCT ON tODS_GLBalance.PageNum = tODS_INF_GLPCT.CTPAGE
    inner join ods.JJill.tods_GLMetadata ON tods_GLMetadata.AcctDescription = tODS_INF_GLPCT.CTDESC
    where
    (tODS_GLBalance.FiscalYearId = 2012) and
    (tODS_GLBalance.FiscalMonthOfYearId = 2) and
    (right(left(CTACCT,13),4)= 3020)
    group by
    right(left(CTACCT,13),4),
    tODS_GLBalance.FiscalYearId,
    tODS_GLBalance.FiscalMonthOfYearId,
    tods_GLMetadata.Metric
    This is the sample output,
    LocationNum FiscalYearId FiscalMonthOfYearId GrossMargin Occupancy Payroll OperatingSales OperatingExpenses
    3020 2012 2 -112477.00 0.00 0.00 0.00 0.00
    3020 2012 2 0.00 0.00 0.00 -158288.94 0.00
    3020 2012 2 0.00 0.00 0.00 0.00 5625.44
    3020 2012 2 0.00 0.00 24185.79 0.00 0.00
    3020 2012 2 0.00 31075.53 0.00 0.00 0.00
    But, i am expecting the output to be something like this
    LocationNum FiscalYearId FiscalMonthOfYearId GrossMargin Occupancy Payroll OperatingSales OperatingExpenses
    3020 2012 2 -112477.00 31075.53 24185.79 -158288.94 5625.44
    Can someone please help me with changing my query to get the desired output?
    Please let me know if you have any questions.
    Thanks

    Try this:
    SELECT DISTINCT
    RIGHT(LEFT(CTACCT,13),4) AS LocationNum, tODS_GLBalance.FiscalYearId AS FiscalYearId, tODS_GLBalance.FiscalMonthOfYearId AS FiscalMonthOfYearId,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Gross Margin' THEN Balance ELSE 0 END ) AS GrossMargin,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Occupancy' THEN Balance ELSE 0 END ) AS Occupancy,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Payroll Dollars' THEN Balance ELSE 0 END ) AS Payroll,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'CF Sales' THEN Balance ELSE 0 END ) AS OperatingSales,
    SUM(CASE WHEN tods_GLMetadata.Metric = 'Operations' THEN Balance ELSE 0 END ) AS OperatingExpenses
    FROM ods.[JJill].[tODS_GLBalance]
    INNER JOIN ods.Staging.tODS_INF_GLPCT
    ON tODS_GLBalance.PageNum = tODS_INF_GLPCT.CTPAGE
    INNER JOIN ods.JJill.tods_GLMetadata
    ON tods_GLMetadata.AcctDescription = tODS_INF_GLPCT.CTDESC
    WHERE tODS_GLBalance.FiscalYearId = 2012
    AND tODS_GLBalance.FiscalMonthOfYearId = 2
    AND RIGHT(LEFT(CTACCT,13),4) = 3020
    GROUP BY right(left(CTACCT,13),4), tODS_GLBalance.FiscalYearId, tODS_GLBalance.FiscalMonthOfYearId, tods_GLMetadata.Metric

  • How to modify this query to get the desired output format

    I hv written a Query to display all the parent table names and their primary key columns(relevant to this foreign key of the child table).The query is given below...
    SELECT DISTINCT(TABLE_NAME) AS PARENT_TABLE,COLUMN_NAME AS PARENT_COLUMN
    FROM ALL_CONS_COLUMNS
    WHERE CONSTRAINT_NAME IN (SELECT AC.R_CONSTRAINT_NAME
    FROM ALL_CONSTRAINTS AC
    WHERE AC.TABLE_NAME=TABLE_NAME
    AND AC.TABLE_NAME='&TABLE'
    AND AC.R_CONSTRAINT_NAME IS NOT NULL);
    This query will display all the parent tables and their primary key columns.Now my problem is that how to modify this query to also display the foreign key column name of the child table.
    I want the query result in the following format.The query should display the following columns.1)child table's name,2)child table's foreign key column name,3)the corresponding parent table's name,4)the parent table's primary key column name(which is the foreign key in the child table).
    For Example I want the output as follows...
    TAKE THE CASE OF SCOTT.EMP(AS INPUT TO YOUR QUERY)
    CHILD_TABLE CHILD_COLUMN PARENT_TABLE PARENT_COLUMN
    EMP DEPTNO DEPT DEPTNO
    In this result I hv used alias name for the columns.The query should display this only for the foreign keys in the child table.In the query which I sent to you earlier will give the parent table and the parent column names,But I also want to append the child table and child column names there.
    any help on how to tackle would be appreciated.

    Try this query
    SELECT c.table_name child_table,
         c.column_name child_column,
         p.table_name parent_table,
         p.column_name parent_column
    FROM user_constraints a,user_constraints b,user_cons_columns c,
         user_cons_columns p
    WHERE a.r_constraint_name=b.constraint_name and
          a.constraint_name=c.constraint_name and
          b.constraint_name=p.constraint_name and
          c.position=p.position
    ORDER BY c.constraint_name,c.position
    Anwar

  • How to modify the code to get started the timer on mentioned time?

    Hi,
    I have the following code from a source. I would like to make a few changes as mentioned below:
    First ....
    1) The as3 code should get the time form "startMeeting_txt.text"
    2) Compare it with current time from "currentTime_txt.text"
    3) The Timer should be activated as soon as the "startMeeting_txt.text" = "currentTime_txt.text" and starts counting
    4) When the "finishMeeting_txt.text" = "currentTime_txt.text" then
    5) "message_txt.text" = "Meeting time is over"
    How to modify the following code:
    var count:Number = 60;
    var myTimer:Timer = new Timer(1000,count);
    myTimer.addEventListener(TimerEvent.TIMER, countdown);
    myTimer.start();
    function countdown(event:TimerEvent):void {
    myText_txt.text = String((count)-myTimer.currentCount);
    if(myText_txt.text == "0"){
          gotoAndStop(2)
    Thanks.

    Thanks. I am at work now and don't have Flash installed on my PC. I will try it at home. I just found this code on a website and wanted to know it more without any try. I must try it first then seek help. I am sorry.
    I do respect your advise.
    Regards.

  • How to use the rownum to get only 5 records?

    Hello Folks,
    I have this queury which pulls in the CLient,EventStatus along with the Events for each user. I just want to condense the data so that each user has not more than 5 events.
    select c.client_code "Client Code",
           c.client_name "Client Name",
           e.event_id "Event ID",             -- there can be 5 or more events per user  
      e.event_status_code "Event Status",
           al.end_user_id "User ID",
           eu.user_real_name "User Name"  -- user    
    al.activity_date "Activity Date",
           al.activity_log_type_code "Activity Type",
           al.activity_party "Activity Party",
           al.activity_subject "Activity Subject",
           al.activity_source "Activity Source",
           al.activity_text "Activity Text",
           e.created_date "Event Created Date"
      from budget b, activity_log al, client c, event e, end_user eu, profile_lookup pl, event_case ec
    where b.event_case_id = al.event_case_id
       and e.event_id = ec.event_id
       and al.event_case_id = ec.event_case_id
       and e.client_id = c.client_id
       and al.end_user_id = eu.end_user_id
       and eu.profile_id = pl.profile_id
       and al.activity_source <> 'SYS'
       and al.activity_log_type_code not in ('MAIL PRINT')
       and (
       (al.activity_log_type_code <> 'PROJECTION')
       or
       (al.activity_log_type_code = 'PROJECTION'and b.budget_status <> 'APPROVED')
       and pl.profile_name like 'NEGOTIATOR%'
       and al.activity_date >= to_date('20101123 000000', 'YYYYMMDD HH24MISS')
       and al.activity_date <= to_date('20101123 235959', 'YYYYMMDD HH24MISS')
    sample data:
    647     IL-FEP     BLUE CROSS BLUE SHIELD OF ILLINOIS     219678     OPEN     867     AARON HILTON     11/23/2010 2:12:44 PM     FAX SENT     SAUL FERRIS     Confirmation of Settlement Amo     MAIL     "Fax of Confirmation of Settlement Amount sent to SAUL FERRIS FAILED.
    Details :
    "     7/11/2009 7:26:45 PMEdited by: user11961230 on Nov 24, 2010 8:11 AM
    Edited by: user11961230 on Nov 24, 2010 8:11 AM
    Edited by: user11961230 on Nov 24, 2010 8:12 AM
    Edited by: user11961230 on Nov 24, 2010 8:18 AM
    Edited by: user11961230 on Nov 24, 2010 8:19 AM

    user11961230 wrote:
    ORA-00923: FROM Keyword not found where expected
    Issue is your original query had not equal condition as &#60;&#62; in two places Since &#60;&#62; has special meaning (empty tag) in HTML, they disappeared. I fixed it in one spot with using != instead but missed the othe. Anyway:
    select  "Client Code",
            "Client Name",
            "Event ID",
            "Event Status",
            "User ID",
            "User Name"    
            "Activity Date",
            "Activity Type",
            "Activity Party",
            "Activity Subject",
            "Activity Source",
            "Activity Text",
            "Event Created Date"
      from  (
             select c.client_code "Client Code",
                    c.client_name "Client Name",
                    e.event_id "Event ID", 
                    e.event_status_code "Event Status",
                    al.end_user_id "User ID",
                    eu.user_real_name "User Name"    
                    al.activity_date "Activity Date",
                    al.activity_log_type_code "Activity Type",
                    al.activity_party "Activity Party",
                    al.activity_subject "Activity Subject",
                    al.activity_source "Activity Source",
                    al.activity_text "Activity Text",
                    e.created_date "Event Created Date",
                    row_number() over(partition by al.end_user_id order by e.event_id) rn
              from  budget b,
                    activity_log al,
                    client c,
                    event e,
                    end_user eu,
                    profile_lookup pl,
                    event_case ec
              where b.event_case_id = al.event_case_id
                and e.event_id = ec.event_id
                and al.event_case_id = ec.event_case_id
                and e.client_id = c.client_id
                and al.end_user_id = eu.end_user_id
                and eu.profile_id = pl.profile_id
                and al.activity_source != 'SYS'
                and al.activity_log_type_code not in ('MAIL PRINT')
                and (
                        (al.activity_log_type_code  'PROJECTION')
                     or
                        (al.activity_log_type_code = 'PROJECTION'and b.budget_status != 'APPROVED')
                and pl.profile_name like 'NEGOTIATOR%'
                and al.activity_date >= to_date('20101123 000000', 'YYYYMMDD HH24MISS')
                and al.activity_date <= to_date('20101123 235959', 'YYYYMMDD HH24MISS')
      where rn <= 5
    / SY.

  • HOW TO CHANGE SQL QUERY TO GET SPECIFIC RESULT

    I HAVE FOLLOWING QUERY AND ITS FUNCTIONING BUT I WANT ALL THOSE RECORD SHOULD BE DISPLADE WICH HAVE NO TRANSACTION IN SALES ANS SALES RETURN WHILE RETREVING DATA FROM DATABASE.
    I TRIED TO USE + OPERATOR BUT I DON'T KNOW HOW TO CHANGE THE QUERY TO GET THE RESULT
    MAIN TABLE IS BEING USED TO FETCH RECORD
    SALES_HEADER,SALES_DETAIL
    SALES_HEADERR,SALES_DETAILR
    STOCK_REG
    AND THE QUERY IS
    select s.item_code,S.DESCR,s.GRAND_TOTAL,
    sum(decode(d.dayno,01,NVL(S.QTY,0),0)) DAY1,
    sum(decode(d.dayno,02,NVL(S.QTY,0),0)) DAY2,
    sum(decode(d.dayno,03,NVL(S.QTY,0),0)) DAY3,
    sum(decode(d.dayno,04,NVL(S.QTY,0),0)) DAY4,
    sum(decode(d.dayno,05,NVL(S.QTY,0),0)) DAY5,
    sum(decode(d.dayno,06,NVL(S.QTY,0),0)) DAY6,
    sum(decode(d.dayno,07,NVL(S.QTY,0),0)) DAY7,
    sum(decode(d.dayno,08,NVL(S.QTY,0),0)) DAY8,
    sum(decode(d.dayno,09,NVL(S.QTY,0),0)) DAY9,
    sum(decode(d.dayno,10,NVL(S.QTY,0),0)) DAY10,
    sum(decode(d.dayno,11,NVL(S.QTY,0),0)) DAY11,
    sum(decode(d.dayno,12,NVL(S.QTY,0),0)) DAY12,
    sum(decode(d.dayno,13,NVL(S.QTY,0),0)) DAY13,
    sum(decode(d.dayno,14,NVL(S.QTY,0),0)) DAY14,
    sum(decode(d.dayno,15,NVL(S.QTY,0),0)) DAY15,
    sum(decode(d.dayno,16,NVL(S.QTY,0),0)) DAY16,
    sum(decode(d.dayno,17,NVL(S.QTY,0),0)) DAY17,
    sum(decode(d.dayno,18,NVL(S.QTY,0),0)) DAY18,
    sum(decode(d.dayno,19,NVL(S.QTY,0),0)) DAY19,
    sum(decode(d.dayno,20,NVL(S.QTY,0),0)) DAY20,
    sum(decode(d.dayno,21,NVL(S.QTY,0),0)) DAY21,
    sum(decode(d.dayno,22,NVL(S.QTY,0),0)) DAY22,
    sum(decode(d.dayno,23,NVL(S.QTY,0),0)) DAY23,
    sum(decode(d.dayno,24,NVL(S.QTY,0),0)) DAY24,
    sum(decode(d.dayno,25,NVL(S.QTY,0),0)) DAY25,
    sum(decode(d.dayno,26,NVL(S.QTY,0),0)) DAY26,
    sum(decode(d.dayno,27,NVL(S.QTY,0),0)) DAY27,
    sum(decode(d.dayno,28,NVL(S.QTY,0),0)) DAY28,
    sum(decode(d.dayno,29,NVL(S.QTY,0),0)) DAY29,
    sum(decode(d.dayno,30,NVL(S.QTY,0),0)) DAY30,
    sum(decode(d.dayno,31,NVL(S.QTY,0),0)) DAY31,
    sum(S.qty) TU
    FROM
    (select nvl(sales_detail.qty+sales_detail.bonus,0) as qty,
    sales_detail.item_code AS ITEM_CODE,
    stock_reg.descr AS descr,
    s_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
    SALES_DETAIL,SALES_HEADER,STOCK_REG
    WHERE SALES_DETAIL.S_ID = SALES_HEADER.S_ID AND
    SALES_DETAIL.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
    STOCK_REG.COMCODE='C1'
    UNION all
    select -1*nvl(sales_detailR.qty+sales_detailR.bonus,0) as qty,
    sales_detailR.item_code AS ITEM_CODE,
    stock_reg.descr AS descr,
    RETURN_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
    STOCK_REG.COMCODE='C1') S,
    (select level as dayno
    from dual
    connect by level <= 31) d
    where d.dayno = to_char(s.sALE_date, 'DD') AND TO_DATE(S.SALE_DATE) BETWEEN '&FROMDATE' AND '&TODATE'
    GROUP BY S.ITEM_CODE,S.DESCR,S.GRAND_TOTAL

    well my query running successfully just the quesion was that i wanted to bring some changes in the query to retrieve the complete record which has no transaction in sales
    for exmple
    if i write the quey
    select dept.deptno,sum(sal) from emp,dept
    where dept.deptno = emp.deptno
    group by dept.deptno
    the recult comes as
    DEPTNO SUM(SAL)
    10 8750
    20 10875
    30 9400
    though there is another deptno which is deptno no 40
    have no sal
    and when i use this query
    select dept.deptno,sum(sal) from emp,dept
    where dept.deptno = emp.deptno(+)
    group by dept.deptno
    it shows the dept no 40 also
    DEPTNO SUM(SAL)
    10 8750
    20 10875
    30 9400
    40
    so to get this i posted query which was to long to understand easily.
    i accept that i sholud post short query to make other understand
    so check out this
    select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
    FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.STOCKCODE = STOCK_REG.STOCKCODE
    AND RETURN_DATE = '01-APR-08'
    GROUP BY STOCK_rEG.item_code
    ORDER BY TO_NUMBER(ITEM_CODE) ASC
    when i execute this query i get the following result
    ITEM_CODE QTY
    84 2
    102 3
    108 3
    116 6
    166 3
    170 3
    thoug there is other items are aalso available in stock which transaction
    yet not been done or not been sold out/
    so when i use the outer join i get the same result
    select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
    FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.STOCKCODE(+) = STOCK_REG.STOCKCODE
    AND RETURN_DATE = '01-APR-08'
    GROUP BY STOCK_rEG.item_code
    ORDER BY TO_NUMBER(ITEM_CODE) ASC
    ITEM_CODE QTY
    84 2
    102 3
    108 3
    116 6
    166 3
    170 3
    hope i tried to make u understand on better way

  • Hellp needed urgent in modifying the query

    my requriment is as follows.
    the data looks like as follows - 3 columns
    sheet_id sequence_no rap_no
    1 2
    1 4
    1 5
    1 1
    2 4
    2 6
    2 7
    3 8
    3 10
    4 3
    4 7
    and the max of seqno should be updated on rap_no.
    is the group by clause not neededin the following query .
    In tht case how to modify the foll query.
         update t3756_cue_sheet_music a set a.c3756_rap_sequence_no=
    (select max(to_number(c3756_sequence_no))
    FROM t3756_cue_sheet_music b
    where a.c3756_cue_sheet_id = b.c3756_cue_sheet_id)
    WHERE c3756_rap_sequence_no is NULL;
    Thanks in advance.
    Do reply

    Can you be a little more clear?
    create table t
    (sheet_id number
    ,sequence_no number
    ,rap_no number);
    alter table t add constraint tpk primary key (sheet_id, sequence_no);
    insert into t (sheet_id, sequence_no) values (1, 2);
    insert into t (sheet_id, sequence_no) values (1, 4);
    insert into t (sheet_id, sequence_no) values (1, 5);
    insert into t (sheet_id, sequence_no) values (1, 1);
    insert into t (sheet_id, sequence_no) values (2, 4);
    insert into t (sheet_id, sequence_no) values (2, 6);
    insert into t (sheet_id, sequence_no) values (2, 7);
    insert into t (sheet_id, sequence_no) values (3, 8);
    insert into t (sheet_id, sequence_no) values (3, 10);
    insert into t (sheet_id, sequence_no) values (4, 3);
    insert into t (sheet_id, sequence_no) values (4, 7);
    update t a
    set a.rap_no=
    (select max(to_number(sequence_no))
    FROM t b
    where a.sheet_id = b.sheet_id)
    WHERE rap_no is NULL;
    select *
      from t;
    SHEET_ID SEQUENCE_NO         RAP_NO
             1           2          5
             1           4          5
             1           5          5
             1           1          5
             2           4          7
             2           6          7
             2           7          7
             3           8         10
             3          10         10
             4           3          7
             4           7          7Doesn't this give you the correct results?

  • How to improve the query performance in to report level and designer level

    How to improve the query performance in to report level and designer level......?
    Plz let me know the detail view......

    first its all based on the design of the database, universe and the report.
    at the universe Level, you have to check your Contexts very well to get the optimal performance of the universe and also your joins, keep your joins with key fields, will give you the best performance.
    at the report level, try to make the reports dynamic as much as you can, (Parameters) and so on.
    and when you create a paremeter try to get it match with the key fields in the database.
    good luck
    Amr

  • How to improve the query performance or tune query from Explain Plan

    Hi
    The following is my explain plan for sql query. (The plan is generated by Toad v9.7). How to fix the query?
    SELECT STATEMENT ALL_ROWSCost: 4,160 Bytes: 25,296 Cardinality: 204                                         
         8 NESTED LOOPS Cost: 3 Bytes: 54 Cardinality: 1                                    
              5 NESTED LOOPS Cost: 2 Bytes: 23 Cardinality: 1                               
                   2 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 13 Cardinality: 1                          
                        1 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   4 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCOUNTS Cost: 1 Bytes: 10 Cardinality: 1                          
                        3 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCOUNTS_U1 Cost: 1 Cardinality: 1                     
              7 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PARTIES Cost: 1 Bytes: 31 Cardinality: 1                               
                   6 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTIES_U1 Cost: 1 Cardinality: 1                          
         10 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              9 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         15 NESTED LOOPS Cost: 2 Bytes: 29 Cardinality: 1                                    
              12 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                               
                   11 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                          
              14 TABLE ACCESS BY INDEX ROWID TABLE ONT.OE_ORDER_HEADERS_ALL Cost: 1 Bytes: 17 Cardinality: 1                               
                   13 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Cardinality: 1                          
         21 FILTER                                    
              16 TABLE ACCESS FULL TABLE ONT.OE_TRANSACTION_TYPES_TL Cost: 2 Bytes: 1,127 Cardinality: 49                               
              20 NESTED LOOPS Cost: 2 Bytes: 21 Cardinality: 1                               
                   18 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                          
                        17 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   19 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Bytes: 9 Cardinality: 1                          
         23 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              22 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         45 NESTED LOOPS Cost: 4,160 Bytes: 25,296 Cardinality: 204                                    
              42 NESTED LOOPS Cost: 4,150 Bytes: 23,052 Cardinality: 204                               
                   38 NESTED LOOPS Cost: 4,140 Bytes: 19,992 Cardinality: 204                          
                        34 NESTED LOOPS Cost: 4,094 Bytes: 75,850 Cardinality: 925                     
                             30 NESTED LOOPS Cost: 3,909 Bytes: 210,843 Cardinality: 3,699                
                                  26 PARTITION LIST ALL Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18          
                                       25 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_HEADERS Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18     
                                            24 INDEX SKIP SCAN INDEX XLA.XLA_AE_HEADERS_N1 Cost: 264 Cardinality: 1,398,115 Partition #: 29 Partitions accessed #1 - #18
                                  29 PARTITION LIST ITERATOR Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32           
                                       28 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_LINES Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32      
                                            27 INDEX RANGE SCAN INDEX (UNIQUE) XLA.XLA_AE_LINES_U1 Cost: 1 Cardinality: 1 Partition #: 32
                             33 PARTITION LIST ITERATOR Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35                
                                  32 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_DISTRIBUTION_LINKS Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35           
                                       31 INDEX RANGE SCAN INDEX XLA.XLA_DISTRIBUTION_LINKS_N3 Cost: 1 Cardinality: 1 Partition #: 35      
                        37 PARTITION LIST SINGLE Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 38                     
                             36 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_EVENTS Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 39 Partitions accessed #2               
                                  35 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_EVENTS_U1 Cost: 1 Cardinality: 1 Partition #: 40 Partitions accessed #2          
                   41 PARTITION LIST SINGLE Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 41                          
                        40 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_TRANSACTION_ENTITIES Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 42 Partitions accessed #2                    
                             39 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_TRANSACTION_ENTITIES_U1 Cost: 1 Cardinality: 1 Partition #: 43 Partitions accessed #2               
              44 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_CODE_COMBINATIONS Cost: 1 Bytes: 11 Cardinality: 1                               
                   43 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_CODE_COMBINATIONS_U1 Cost: 1 Cardinality: 1

    damorgan wrote:
    Tuning is NOT about reducing the cost of i/o.
    i/o is only one of many contributors to cost and only one of many contributors to waits.
    Any time you would like to explore this further run this code:
    SELECT 1 FROM dual
    WHERE regexp_like(' ','^*[ ]*a');but not on a production box because you are going to experience an extreme tuning event with zero i/o.
    And when I say "extreme" I mean "EXTREME!"
    You've been warned.I think you just need a faster server.
    SQL> set autotrace traceonly statistics
    SQL> set timing on
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');
    no rows selected
    Elapsed: 00:00:00.00
    Statistics
              1  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            243  bytes sent via SQL*Net to client
            349  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processedRepeated from an Oracle 10.2.0.x instance:
    SQL> SELECT DISTINCT SID FROM V$MYSTAT;
           SID
           310
    SQL> ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    Session altered.
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');The session is hung. Wait a little while and connect to the database using a different session:
    COLUMN STAT_NAME FORMAT A35 TRU
    SET PAGESIZE 200
    SELECT
      STAT_NAME,
      VALUE
    FROM
      V$SESS_TIME_MODEL
    WHERE
      SID=310;
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0Seems to be using a bit of time for the hard parse (hard parse elapsed time). Wait a little while, then re-execute the query:
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0The session is not reporting additional CPU usage or parse time.
    Let's check one of the session's statistics:
    SELECT
      SS.VALUE
    FROM
      V$SESSTAT SS,
      V$STATNAME SN
    WHERE
      SN.NAME='consistent gets'
      AND SN.STATISTIC#=SS.STATISTIC#
      AND SS.SID=310;
         VALUE
           163Not many consistent gets after 20+ minutes.
    Let's take a look at the plan:
    SQL> SELECT SQL_ID,CHILD_NUMBER FROM V$SQL WHERE SQL_TEXT LIKE 'select 1 from du
    al%';
    SQL_ID        CHILD_NUMBER
    04mpgrzhsv72w            0
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('04mpgrzhsv72w',0,'TYPICAL'))
    select 1 from dual where regexp_like   (' ','^*[ ]*a')
    NOTE: cannot fetch plan for SQL_ID: 04mpgrzhsv72w, CHILD_NUMBER: 0
          Please verify value of SQL_ID and CHILD_NUMBER;
          It could also be that the plan is no longer in cursor cache (check v$sql_p
    lan)No plan...
    Let's take a look at the 10053 trace file:
    Registered qb: SEL$1 0x19157f38 (PARSER)
      signature (): qb_name=SEL$1 nbfros=1 flg=0
        fro(0): flg=4 objn=258 hint_alias="DUAL"@"SEL$1"
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    CVM: Considering view merge in query block SEL$1 (#0)
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    Subquery Unnest
    SU: Considering subquery unnesting in query block SEL$1 (#0)
    Set-Join Conversion (SJC)
    SJC: Considering set-join conversion in SEL$1 (#0).
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    PM:     PM bypassed: Outer query contains no views.
    FPD: Considering simple filter push in SEL$1 (#0)
    FPD:   Current where clause predicates in SEL$1 (#0) :
              REGEXP_LIKE (' ','^*[ ]*a')
    kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#0)
    predicates with check contraints:  REGEXP_LIKE (' ','^*[ ]*a')
    after transitive predicate generation:  REGEXP_LIKE (' ','^*[ ]*a')
    finally:  REGEXP_LIKE (' ','^*[ ]*a')
    apadrv-start: call(in-use=592, alloc=16344), compile(in-use=37448, alloc=42256)
    kkoqbc-start
                : call(in-use=592, alloc=16344), compile(in-use=38336, alloc=42256)
    kkoqbc-subheap (create addr=000000001915C238)Looks like the query never had a chance to start executing - it is still parsing after 20 minutes.
    I am not sure that this is a good example - the query either executes very fast, or never has a chance to start executing. But, it might still make your point physical I/O is not always the problem when performance problems are experienced.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • How to fetch the query string in BW?

    Hi Gurus,
    How can fetch the query string from BW Server to implement  Bex web application Iview.
    *Now to get the information "BEx Web Application Query String". open the SAP Log on and open the BW Browser, double click any of the queries available, this will open a window and select the Query String ( it should be between & to end &).*
    Explain the above point with more detail like how will open the bw browser what is the step for that?where the query string will available in BW browser.
    Higher points will be rewarded for valuable inputs.
    Thanks in Advance,
    Dharani

    hi ,
    What krishna suggested is right ... Another method can be like :
    &CMD=LDOC&infocube=0D_DECU&query=SALES_DEMO_2
    Get this information from your BI consultant.
    Please close thread if you got ur answer!!!
    Regards
    Parth

  • How to find the query name using infoset name

    Hi Experts
           Iam new to the sap queries(SQ01,SQ02), some queries already created.
          now i want to do some modification, my problem is i am not able to find the query name.
          I know the infoset name, can you tell me how to find the query name using the infoset name, is ther any table for this.
    i tried in sq01 also, but its confusion, pls advice me on this.
    thanks in advance.
    regards
    rajaram

    Hi
    try like this..
    SQ02 --> go to --> Query Directory..
    from there you can get all the queries belong to a Infoset.

  • How to fetch the query by a report

    Post Author: gionnyDeep
    CA Forum: Data Connectivity and SQL
    How to fetch the query by  a report.I need to manipulate it and pass it again to the report.
    Any idea?

    Post Author: gionnyDeep
    CA Forum: Data Connectivity and SQL
    I just need to get the query of a report.
    You know that a report is buld up on a sql query.I just want to know how to get that query starting by  a java ReportClientDocument.
    And I found reportClientDoc.getDatabaseController().getDatabase() to fetch DataBase object .After that I do not know the exact sequence of methods for fetch the query
    Sorry for my english

  • How can Modify the Text of a MessageArea in a Application WD ABAP Standard?

    Dear Experts.
    How can Modify the Text of a MessageArea in a Application WD ABAP Standard?
    I found the following link in the helpsap, but in this moment I don't know How found this text? and Modify this text with a new text.
    http://help.sap.com/saphelp_nw70/helpdata/en/3a/f6ba42a950da11e10000000a155106/frameset.htm
    The text of a MessageArea are in a table of configuration or can do the system for get this text and show in the application in the portal? How can get this and modify by a new text.
    Please help me with a suggestions.
    Thanks
    Regards
    Carmen G.

    Dear Kranthi..
    The datas of the Application is the following:
    General Information About the Application and Component
    Application: FITE_REQUEST
    Web Dynpro Component: FITV_FPM
    Window Information: FPM_WINDOW
    View Information: Layout_view
    Information on Field
    Field ID: HELPTEXT
    Type of UI Element : Explanation
    Attributes of UI Element
    TEXT_DOCUMENT_NAME: FITE_FPM_REQUEST_GENERAL_DA
    I dont found this method L_MESSAGE_MANAGER->REPORT_T100_MESSAGE.
    Please can give more suggestions for found the method
    Thanks in advance
    Regards
    Carmen G.

  • How to find the query that generates print preview?

    Hello,
    How can I find the query that gets executed to generate  print preview? On SAP Business One client if I open a Sales Quotation and click on print preview a report is generated. What queries are run in the background to generate this report?
    Thanks for your help.
    Regards,
    Sheetal

    Hi Sheetal,
    In such cases i am using a Profiler which is connected to my company's database. If you are using SQL-Server, the start the "Profiler", connect it to your database server and start the trace. When the trace is running, execute the SBO action. After you executed this action you will see in the profiler the excuted SQL-Statements.
    Regards,
    Christian

  • CJ31 - How to modifying the assigned budget

    Hi gurus,
    We have checked that in our system we have incorrect values in the Budget database. this is because we have posted invoices directly in FI by a batch input calling to the tcode FB01. We post this with reference to Purchase orders populating the field "purchase order". I mean, the FI invoice has the field PO document filled out with the PO number. We close the PO number manually.
    The problem is that even the invoice is with the same amount than the PO, the assigned budget in transaction CJ31 is being modified in the value for instead remaining without changes. Transaction MIRO makes a check in the PO when being posted but FB01 not. In fact in MIRO if the amount is greater than PO, the assigned value is increased.
    SAP has indicated that FB01 is not connected to the commitment system as MIRO so this is the correct behavior of system. At this point we are going to start using the standard procedure. However we need to correct the current data we assigned to the .
    Therefore we have the in budget database corrupted since they are duplicated or even more than duplicated.
    My question is how to modify the assigned budget?
    -Is there any way from a functional point of view (executing some transaction or program) to reduce the assigned budget for errors like this?
    -In case that this is not possible by t-code or program, is there any idea of tables we need to adjust? We know that the table PJPA registers the annual records and assigned values are displayed in fields WTJHR and WLJHR but we cannot modify only this table in case there are other tables linked.
    Many thanks in advance and kind regards

    Hi Varun,
    Thanks for replying. I checked the note you linked. However I didn't find a solution
    CJEN and CJBN are not an option for us. With these transaction we can rebuild the data but the wrong data is already imputed in my system. Just to clarify. My requirement is getting a way to amend the values we have in the assigned value. From the system point of view the assigned budget is correct because it was imputed from FI. But in terms of my business we are duplicating the assigned (Purchase orde an FI document). Therefore we are searching for modify the assigned value in order to represent the real budget state.
    Kind Regards

Maybe you are looking for

  • Which browser is best for macbook pro?

    Which browser is best for macbook pro. I have used Safari for a couple of years but have been told recently that I would be better switching to Chrome

  • Problem with 'Fade Out'

    As part of an edit, I am trying to both 'Fade In' and 'Fade Out' of a particular video. The 'Fade In' works fine, but I'm having problems with the 'Fade Out'. For some strange reason, while the video part of it fades out properly, the audio that also

  • IPhoto library is not loading in any application that uses it, how do I fix

    I am unable to get iPhoto to load, I am not sure what went wrong. Can someone please tell me how to resolve this. Thanks in advance, Sebastian

  • Unable to adjust clip length by dragging

    Please help me.. I am no longer able to drag the still photo clips in iMovie 5.0.2 to length, they just move up and down the time line. I have been able to adjust them willy-nilly in the recent past but no longer. Did i wear it out? What's the simple

  • Photos not importing / import issue

    Pleeeeeease help me. This is driving me crazy! I have what seems like an intermittent problem with LR4.3. Sometimes it lets me import and edit no problem, then sudenly the import won't work almost like it can't see the images because the preview does