Help needed in Query design

Hello Query experts,
I have the following data in my DSO.
Char1      date                      Kf1     KF2
a           01.01.2011              10       20
a           03.01.2011              50       70
a           05.01.2011                5       10
b           02.01.2011              20        25
b           05.01.2011              10        15
b           06.01.2011               5         15
Now, I need to design a query to produce the following result:
Char1      date                      Kf1     KF2     KF3(KF2-KF1)        KF4
a           01.01.2011              10       20             10                     10
a           03.01.2011              50       70             20                     30 [KF3+Prev(KF4)]
a           05.01.2011                5       10              5                      35
b           02.01.2011              20       25              5                       5
b           05.01.2011              10       15              5                      10
b           06.01.2011               5        15             10                     20
Can anybody help me achieve this through a BI Query?
Thanks and regards,
Jashua

HI,
I think kf3 can easily be created at query level itself without writing complex logic..As far as i understand your requirement kf3 is a differnce of kf2 and kf1.
so jst make local formula and in that put kf2-kf1.it will give you the desired output for kf3.
Kf4 i need to think,i will update you soon

Similar Messages

  • Help needed with a design!

    HELP! I need help with designing something!
    IMAGE on this link " http://i1072.photobucket.com/albums/w362/jjnilsson/DSC_0188.jpg "
    i need this patch on the picture to be "remade" in higher definition and the text should be MILF HUNTERS intstead of milf hunter... Anyone that might be able to help me out?
    reson for all this is that its gonna be made to a 30x40cm big patch fitting the back of our Team jackets!
    send me a pm or a mail ([email protected]) if you need any futher info or if you can help me out! I am really thankful for all the help i can get!
    With best regards J. Nilsson, Milf Hunters Mc

    I simply did as i got a tip on FB to do
    quote from adobe themselves on facebook "Adobe Illustrator You might also want to try asking on our forums as there are many people that can help there as well! http://forums.adobe.com/community/illustrator/illustrator_general"
    sry if it was wrong of me, simply thought there might be someone nice out there to give a helping hand
    Date: Tue, 5 Jun 2012 13:41:48 -0600
    From: [email protected]
    To: [email protected]
    Subject: Help needed with a design!
        Re: Help needed with a design!
        created by in Illustrator - View the full discussion
    This really isn't the place to ask for free services.
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4467790#4467790
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4467790#4467790. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Illustrator by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Help needed with Report Design

    Hi All,
    Here is the requirement.
    Period Type(holds 2 values) : Payment and Vested.
    we have field 'Total Days' which is calculated based on "User Selected" Period Type.
    For example, When Period Type is Payment,
    If start date is less than or equal to grant date and end date is less than or equal to vest date, then calculation is (End Date - Grant Date)+1
    If start date is greater than grant date and end date is less than or equal to vest date, then calculation is (End Date - Mobility Start Date)+1 (similarly 2 more if conditions) ...we have similar calculation for Period Type - 'Vested'.
    This Period Type is a multiselect Prompt. How can this be achievable.
    Any thoughts will be greatly appreciated.
    Thanks.

    I simply did as i got a tip on FB to do
    quote from adobe themselves on facebook "Adobe Illustrator You might also want to try asking on our forums as there are many people that can help there as well! http://forums.adobe.com/community/illustrator/illustrator_general"
    sry if it was wrong of me, simply thought there might be someone nice out there to give a helping hand
    Date: Tue, 5 Jun 2012 13:41:48 -0600
    From: [email protected]
    To: [email protected]
    Subject: Help needed with a design!
        Re: Help needed with a design!
        created by in Illustrator - View the full discussion
    This really isn't the place to ask for free services.
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4467790#4467790
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4467790#4467790. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Illustrator by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Need help in bex query designer

    hi experts ,
    Actually we had a ODS where the KPI's values  for all weeks are present and also the module.
    in the query designer we need to show the targets for respective KPI's modulewise.
    the requirement is
    module-selections
    week no-selection
    targetweek1week2---week3
    KPI1--10090---90--
    90
    KPI2--95-7885-----90
    based on the module selection the targets values should change and also there should not be any restriction on weeks.
    and also exceptions needs to be done for color coding.
    we actually implemented cell defination for getting the above requirement , but here the problem is that we need to fix the  targets and there is arestriction on the weeks . but the requirement should be dynamic i.e, the targets should be configurable and the weeks should not be restricted.
    in the backend ODS all weeks data is present. we just need an idea how to fix these targets and also color coding for the respective KPI's without using cell defination.
    Kindly throw some pointers how to acheive this..
    thanks in advance,
    Madhu

    Hi Madhuri,
      Ur requirement can be done by using a customer exit variable,keeping any sap stand. time characteristics value.
    If u want to define the any selection dynamically,make a new selection with the text variable and call the customer exit variable into it and assaign the corresponding KPI into it and there by u can define the offset value as well.
      for writting the customer exit,u need to contact ur ABAP'er and say the requirement.
    Hope this helps!!

  • HELP -- About a query design

    how to calculate a characteristic's  different value? let me give a example:
    i have a infocube, it has three characteristics: Grandfather, father, SonOrDaughter and one key figure : counter. from the data point of view, One Grandfather may have n(>=0) sons(it means many fathers belong to 1 grandfather) and one father can have m(>=0) sons or daughters. Our key figure always equal 1 for each record in the infocube.
    Now I need a query to display the number of the fathers who have son. Attention: if a father have two son, it should only be count once.
    HELP!

    Hi,
    In the Query Designer Right click on the Characteristic and Key Figure and choose the properties as specified
    Example-
    report with monthly sales. the months are decided at runtime. sales values for each month are displayed in columns for each month. The result (total for all months for a customer) is seen.
    how to calculate running average for this total? i know the total value, but is determined at runtime. also the denominator i.e the no. of months for which the values exist is also known only at runtime.
    Go to BEx Designer, right click on Key figure & choose "calculate Result as Average".
    Hareesh

  • Help needed in Query

    I have one table Prd_mst, I need a query or function where whenever i pass the child_id into query or function i get the Parent_id of that
    example Data is below :-
    P_ID,P_NAME,C_ID
    null,Computer,1
    1,KeyBoard,2
    1,Mouse,3
    1,Mother Board,4
    3,Scroll Mouse,5
    3,Optical Scroll Mouse,6
    3,Fibre Scroll Mouse,7
    2,Multimedia Key Board,8
    2,Cordless Key Board,10
    2,Normal Key Board,9
    4,586 Mother Board,13
    4,386 Mother Board,11
    4,486 Mother Board,12
    4,P1 Mother Board,14
    4,P2 Mother Board,15
    4,P3 Mother Board,16
    4,P4 Mother Board,17
    14,533 Mhtz P1 CPU,19
    14,433 Mhtz P1 CPU,18
    19,533 Mhtz P1 CPU With 100Mhtz BUS,20
    19,533 Mhtz P1 CPU With 133Mhtz BUS,21
    18,433 Mhtz P1 CPU With 100Mhtz BUS,22
    So when ever i put the child id as 22 i should get the 14
    So when ever i put the child id as 21 i should get the 14
    So when ever i put the child id as 9 i should get the 1
    So when ever i put the child id as 15 i should get the 1
    So when ever i put the child id as 5 i should get the 1
    So when ever i put the child id as 3 i should get the null
    So when ever i put the child id as 14 i should get the 1.
    Please help me......
    There is one complex requirement in matrix format.
    Need P_ID , P_NAME , Count( child records)
    P_(nth), P_NAME(nth), Count(child record) nth times.
    Child is again the parent of some child.
    Report is needed for audit purpose.
    Message was edited by: Sandeep Sharma
    Sandeep Sharma

    SQL> CREATE TABLE SANDEEP(P_ID NUMBER,P_NAME VARCHAR2(100),C_ID NUMBER);
    Table created.
    SQL> INSERT INTO SANDEEP VALUES(null,'Computer',1);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(1,'KeyBoard',2);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(1,'Mouse',3);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(1,'Mother Board',4);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(3,'Scroll Mouse',5);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(3,'Optical Scroll Mouse',6);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(3,'Fibre Scroll Mouse',7);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(2,'Multimedia Key Board',8);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(2,'Cordless Key Board',10);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(2,'Normal Key Board',9);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(4,'586 Mother Board',13);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(4,'386 Mother Board',11);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(4,'486 Mother Board',12);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(4,'P1 Mother Board',14);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(4,'P2 Mother Board',15);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(4,'P3 Mother Board',16);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(4,'P4 Mother Board',17);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(14,'533 Mhtz P1 CPU',19);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(14,'433 Mhtz P1 CPU',18);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(19,'533 Mhtz P1 CPU With 100Mhtz BUS',20);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(19,'533 Mhtz P1 CPU With 133Mhtz BUS',21);
    1 row created.
    SQL> INSERT INTO SANDEEP VALUES(18,'433 Mhtz P1 CPU With 100Mhtz BUS',22);
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> set null null
    SQL> SELECT P_ID
      2    FROM SANDEEP
      3     WHERE LEVEL = 2
      4     START WITH C_ID = &1
      5     CONNECT BY C_ID = PRIOR P_ID;
    Enter value for 1: 22
    old   4:    START WITH C_ID = &1
    new   4:    START WITH C_ID = 22
          P_ID
            14
    SQL> /
    Enter value for 1: 21
    old   4:    START WITH C_ID = &1
    new   4:    START WITH C_ID = 21
          P_ID
            14
    SQL> /
    Enter value for 1: 9
    old   4:    START WITH C_ID = &1
    new   4:    START WITH C_ID = 9
          P_ID
             1
    SQL> /
    Enter value for 1: 15
    old   4:    START WITH C_ID = &1
    new   4:    START WITH C_ID = 15
          P_ID
             1
    SQL> /
    Enter value for 1: 5
    old   4:    START WITH C_ID = &1
    new   4:    START WITH C_ID = 5
          P_ID
             1
    SQL> /
    Enter value for 1: 3
    old   4:    START WITH C_ID = &1
    new   4:    START WITH C_ID = 3
          P_ID
    null
    SQL> /
    Enter value for 1: 14
    old   4:    START WITH C_ID = &1
    new   4:    START WITH C_ID = 14
          P_ID
             1
    SQL> SY.

  • Help needed in selecting Design

    Hi all,
    I need your help in designing WLI.We need to receive messages(string) from network(sockets) and process it in WLI, send it back.Can any one pls help me which connection method(HTTP/TCP/JMS) is suitable, how to configure WLS for that?
    Thanks in Advance

    HI,
    I think kf3 can easily be created at query level itself without writing complex logic..As far as i understand your requirement kf3 is a differnce of kf2 and kf1.
    so jst make local formula and in that put kf2-kf1.it will give you the desired output for kf3.
    Kf4 i need to think,i will update you soon

  • Help needed for Query writing

    Hi,
    I've select query to retrive the data in the following order
    Sequnce ID Model Barcode
    1 Dell 123
    2 Dell 124
    3 Dell 125
    4 HP 126
    5 hp 127
    6 hp 128
    7 apple 129
    8 apple 130
    I want the following to be selected round robin for Dell and Hp laptop alone as mentioned below.
    Sequnce ID Model Barcode
    1 Dell 123
    4 HP 126
    2 Dell 124
    5 hp 127
    3 Dell 125
    6 hp 128
    7 apple 129
    8 apple 130
    Can you help me to acheive this?
    Thanks!

    Hi,
    user601042 wrote:
    Hi,
    I've select query to retrive the data in the following order
    Sequnce ID Model Barcode
    1 Dell 123
    2 Dell 124
    3 Dell 125
    4 HP 126
    5 hp 127
    6 hp 128
    7 apple 129
    8 apple 130If that's what you want, then it looks like
    ORDER BY  barcodeis all you need.
    If you want the results sorted as below, Then you can use the analytic ROW_NUMBER function:
    ORDER BY  CASE
                    WHEN  UPPER (model) IN  ('DELL', 'HP')
              THEN  ROW_NUMBER () OVER ( PARTITION BY  UPPER (model)
                                                 ORDER BY      barcode
           END
    ,       barcode
    I want the following to be selected round robin for Dell and Hp laptop alone as mentioned below.
    Sequnce ID Model Barcode
    1 Dell 123
    4 HP 126
    2 Dell 124
    5 hp 127
    3 Dell 125
    6 hp 128
    7 apple 129
    8 apple 130Either way, I assume that sequnce id is not actually in your table.
    Edited by: Frank Kulash on Mar 14, 2013 12:38 PM
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • SQL HELP NEEDED IN QUERY FOR COUNT

    I Have this Query
    SUM (CASE WHEN b.VET_OTHR_ELIG_CDE IN ('02', '03', '04') THEN 1 END) AS VET_YES,
    SUM (CASE WHEN b.VET_OTHR_ELIG_CDE = '01' THEN 1 END) VET_NO, COUNT (E.ACTV_CDE) AS CNT_ACTV_CDE
    Now i need to Add two more columns from the same Query Showing the count of VET_YES and VET_NO i.e count of TOTAL Veterans And TOTAL Non Veterans
    those two columns i will be using as summary columns in my report.The bolded columns are those which i need to show the total column .anyone please help in this issue ..
    ACTV_DESC ACTV_CDE VET_YES VET_NO CNT_ACTV_CDE
    INACT DUE 13993 2 1 3
    NOW I NEED TO MAKE IT LIKE THIS
    ACTV_DESC ACTV_CDE VET_YES VET_NO CNT_VET CNT_NONVET CNT_ACTV_CDE (This is the total count)
    INACT DUE 13993 2 1 2 1 3
    Thanks in Advance,
    Dev Kishore.T
    Message was edited by:
    Dev Kishore
    Message was edited by:
    Dev Kishore

    Check this link.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#sthref1612
    Regards
    Raj

  • Help Needed XML query

    I have troubles with my XML query. It returns to many results and double results.
    My code
    select xmlelement("test", XMLAgg(xmlelement("Customer", XmlAttributes(a.CUSTOMER_ID "cid"))),
    XMLAgg(xmlelement("Account", xmlagg(xmlelement("Account", b.ACCOUNT_ID) ))),
    XMLAgg(xmlelement("ServicePoint", xmlagg(xmlelement("sp", c.SPID) ))) ).extract('*').getstringval() xml
    From DM_SERVICE_POINT c, DM_CUSTOMER a, DM_ACCOUNT b where a.CUSTOMER_ID = b.CUSTOMER_ID And a.CUSTOMER_ID=c.CUSTOMER_ID AND a.CUSTOMER_ID='15058'
    group by a.CUSTOMER_ID
    i have 1 customer id in the table dm_customer, 2 account_id 's that are linked to customer_id with a FK. DM_Servicepoint contains 6 rows that are linked to dm_customer with a FK.
    My result is 1 result for customer, thats correct but account shows 12 results, where i expect 2 results
    and Service point shows also 12 records where i expect 6 records.
    There is no direct link between account and service point but both are linked to customer. Each customer can have 1 or 2 account And each customer can have 1 or many servicepoints.
    Can you help me?
    Message was edited by:
    Marinda

    Now to see whether we can get this to work with XML....Turns out it's a lot easier than I thought it would be:
    SQL> select dbms_xmlgen.getxml('select c.name
      2         , cursor(select a.acctno, a.name
      3                  from my_accounts a
      4                  where a.cust_id = c.id ) as accounts
      5         , cursor(select s.sp_ref
      6                  from my_service_points s
      7                  where s.cust_id = c.id ) as srv_points
      8  from   my_customers c
      9  ') from dual
    10  /
    DBMS_XMLGEN.GETXML('SELECTC.NAME,CURSOR(SELECTA.ACCTNO,A.NAMEFROMMY_ACCOUNTSAWHE
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <NAME>APC</NAME>
      <ACCOUNTS>
       <ACCOUNTS_ROW>
        <ACCTNO>900000</ACCTNO>
        <NAME>No1 a/c</NAME>
       </ACCOUNTS_ROW>
       <ACCOUNTS_ROW>
        <ACCTNO>900002</ACCTNO>
        <NAME>Business</NAME>
       </ACCOUNTS_ROW>
      </ACCOUNTS>
      <SRV_POINTS>
       <SRV_POINTS_ROW>
        <SP_REF>SP1</SP_REF>
       </SRV_POINTS_ROW>
       <SRV_POINTS_ROW>
        <SP_REF>SP2</SP_REF>
       </SRV_POINTS_ROW>
       <SRV_POINTS_ROW>
        <SP_REF>SP3</SP_REF>
       </SRV_POINTS_ROW>
       <SRV_POINTS_ROW>
        <SP_REF>SP4</SP_REF>
       </SRV_POINTS_ROW>
       <SRV_POINTS_ROW>
        <SP_REF>SP5</SP_REF>
       </SRV_POINTS_ROW>
       <SRV_POINTS_ROW>
        <SP_REF>SP6</SP_REF>
       </SRV_POINTS_ROW>
      </SRV_POINTS>
    </ROW>
    <ROW>
      <NAME>MARINDA</NAME>
      <ACCOUNTS>
       <ACCOUNTS_ROW>
        <ACCTNO>900004</ACCTNO>
        <NAME>Checking</NAME>
       </ACCOUNTS_ROW>
      </ACCOUNTS>
      <SRV_POINTS>
       <SRV_POINTS_ROW>
        <SP_REF>SP7</SP_REF>
       </SRV_POINTS_ROW>
       <SRV_POINTS_ROW>
        <SP_REF>SP8</SP_REF>
       </SRV_POINTS_ROW>
      </SRV_POINTS>
    </ROW>
    </ROWSET>
    SQL> Obviously you'll need to do some smartening up of the tag names.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • Urgent Help Needed Union Query

    Hello All
    I have a complex query (at least i think) which returns result set. Now i want to add to it the records that were not mached by the query i tried
    <Query1>
    Union all
    <Query2> where not in <query1> (hope i am able to express myself)
    but it takes a lot of time
    is there any way that query1 is refered once or i have to redefine the query
    Any Help ??????
    Thanks in advance

    I think i am unable to clearly express myself
    When i try to use outer join error occures end-of-file on communication channel. actualy i have a poorly designed database structure which is not in my control but i am supposed to report on it
    <query1>
    union all
    <Query2> where not in <query1>
    i wanted to say query 1 returns a result set and query 2 reurns rows not selected by query 1
    any workaround

  • Help needed - containers at design time

    I'm new to Flash, and I'm having trouble with some basic
    concepts. Here's my project:
    I've created a state map, with each county broken out as a
    symbol. I can traverse the DisplayObject list and manipulate each
    county as needed. That all seems to work ok.
    The problem: in addition to the county symbols, I have
    several other objects in my scene (text layers, logos, etc). I'd
    like to move the county symbols to a container, so I can traverse
    that container without the other objects getting in the mix. Doing
    this in AS would be cumbersome and bug-prone. How can I create such
    a container at design time? The only technique I could find was
    selecting all the counties and making them a symbol, but then I
    can't manipulate the individual counties.
    Any help? I'd appreciate any advice. I'm not new to OOP, but
    this is a very different world. Thanks!

    1. Create an empty map MovieClip
    2. Select edit (in the right click menu)
    3. Create all the countries in the map MovieClip
    4. Assign a descriptive instance name to the map instance on
    the stage

  • Help needed in payslip design

    hi experts
      My client is asking to create new payslip.
      how can i desing and assing wagtypes to those field.
      i got around 50 field in the payslip.
      i know the tcode pe51.
       is there any differnce between pe51 and se71 ?
      please help me
    regards

    HI,
    I think kf3 can easily be created at query level itself without writing complex logic..As far as i understand your requirement kf3 is a differnce of kf2 and kf1.
    so jst make local formula and in that put kf2-kf1.it will give you the desired output for kf3.
    Kf4 i need to think,i will update you soon

  • Help needed in query optimization.....

    Hi
    I have this below query which automatically gets generated in siebel.
    Problem is when i execute this query in toad for "Nichole" it took 2 mins to return 30 records but when i execute this same query for "Adam" it returns more records than Nichole and return results in 1-2 secs. i Know executing query in toad is not a proper way but this below query will get executed in same way thru siebel application. Histogram is already created on column "Name" but of no help. Composite Index(CX_AA_EVNT_RADIO_BATCH_TIME) is there on column bot_id & timestp.
    Table s_org_ext has only 5 records of "Nichole" and 10 records of "Adam".
    Will including Column "Name" in Above composite index can help?
    Please anybody can suggest me anything in this? whatelse i can do to tune this query?
    Thanks for your help in advance
    Chandan Singh
    Also, don't know how better i can format this code :-(
    SELECT t7.conflict_id, t7.last_upd, t7.created, t7.last_upd_by,
    t7.created_by, t7.modification_num, t7.row_id, t7.last_upd,
    t7.aa_acount_id, t7.aa_last_step, t7.accessory, t7.account_exists,
    t7.account_number, t7.actn_cd, t7.action_counter, t7.activated_by,
    t7.address, t7.address_2, t7.address_validation_status,
    t4.account_name, t7.aggregated_account_id, t7.aggregated_flag,
    t7.asset_id, t7.auto_delivery_type, t7.auto_make, t7.auto_model,
    t7.auto_year, t7.automated_approval, t7.activation_frequency,
    FROM siebel.s_prod_int t1,
    siebel.s_org_ext t2,
    siebel.s_asset t3,
    siebel.av_account t4,
    siebel.s_org_ext t5,
    siebel.s_prod_int_x t6,
    siebel.av_event t7
    WHERE t1.row_id = t6.par_row_id(+)
    AND t7.promotion_code = t1.part_num(+)
    AND t7.asset_id = t3.row_id(+)
    AND t3.owner_accnt_id = t5.par_row_id(+)
    AND t7.id = t2.par_row_id --- S_ORG_EXT_U3
    AND t7.id1 = t4.row_id(+)
    AND (t2.NAME = 'Nichole')
    ORDER BY t7.bot_id, t7.timestp
    Below is the execution plan for above query.
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=399904 Card=5609601 Bytes=4930839279)
    1 0 NESTED LOOPS (OUTER) (Cost=399904 Card=5609601 Bytes=4930839279)
    2 1 NESTED LOOPS (OUTER) (Cost=343808 Card=5609601 Bytes=4824256860)
    3 2 NESTED LOOPS (OUTER) (Cost=231616 Card=5609601 Bytes=4740112845)
    4 3 NESTED LOOPS (OUTER) (Cost=175520 Card=5609601 Bytes=4482071199)
    5 4 NESTED LOOPS (OUTER) (Cost=119424 Card=5609601 Bytes=4325002371)
    6 5 NESTED LOOPS (Cost=63328 Card=5609601 Bytes=4240858356)
    7 6 TABLE ACCESS (BY INDEX ROWID) OF 'av_event' (Cost=6729 Card=5659910 Bytes=4126074390)
    8 7 INDEX (FULL SCAN) OF 'av_event_timpstp' (NON-UNIQUE) (Cost=24559 Card=5659910)
    9 6 TABLE ACCESS (BY INDEX ROWID) OF 'S_ORG_EXT' (Cost=1 Card=1 Bytes=27)
    10 9 INDEX (UNIQUE SCAN) OF 'S_ORG_EXT_U3' (UNIQUE)
    11 5 TABLE ACCESS (BY INDEX ROWID) OF 'S_PROD_INT' (Cost=1 Card=1 Bytes=15)
    12 11 INDEX (RANGE SCAN) OF 'S_PROD_INT_M3' (NON-UNIQUE)
    13 4 TABLE ACCESS (BY INDEX ROWID) OF 'av_account' (Cost=1 Card=1 Bytes=28)
    14 13 INDEX (UNIQUE SCAN) OF 'av_account_P1' (UNIQUE)
    15 3 TABLE ACCESS (BY INDEX ROWID) OF 'S_ASSET' (Cost=1 Card=1 Bytes=46)
    16 15 INDEX (UNIQUE SCAN) OF 'S_ASSET_P1' (UNIQUE)
    17 2 TABLE ACCESS (BY INDEX ROWID) OF 'S_PROD_INT_X' (Cost=1 Card=1 Bytes=15)
    18 17 INDEX (RANGE SCAN) OF 'S_PROD_INT_X_U1' (UNIQUE) (Cost=1 Card=1)
    19 1 TABLE ACCESS (BY INDEX ROWID) OF 'S_ORG_EXT' (Cost=1 Card=1 Bytes=19)
    20 19 INDEX (UNIQUE SCAN) OF 'S_ORG_EXT_U3' (UNIQUE)
    Below is the No. of records in each table.
    NUM_ROWS     LAST_ANALYZED     TABLE_NAME     BLOCKS
    5,594,027.00     09/08/2006 03:03:02     av_account     92,565.00
    6,659,910.00     09/22/2006 16:14:06     av_event      608,292.00
    15,384,080.00     09/22/2006 15:28:04     S_ASSET     1,244,124.00
    10,249,905.00     04/23/2006 23:51:44     S_ORG_EXT     2,313,814.00
    1,081.00     09/22/2006 15:26:12     S_PROD_INT     129.00
    602.00     09/08/2006 04:39:42     S_PROD_INT_X     10.00

    can you plz try this
    SELECT /*+ LEADING(t2) */ t7.conflict_id, t7.last_upd, t7.created, t7.last_upd_by,
    t7.created_by, t7.modification_num, t7.row_id, t7.last_upd,
    t7.aa_acount_id, t7.aa_last_step, t7.accessory, t7.account_exists,
    t7.account_number, t7.actn_cd, t7.action_counter, t7.activated_by,
    t7.address, t7.address_2, t7.address_validation_status,
    t4.account_name, t7.aggregated_account_id, t7.aggregated_flag,
    t7.asset_id, t7.auto_delivery_type, t7.auto_make, t7.auto_model,
    t7.auto_year, t7.automated_approval, t7.activation_frequency,
    FROM siebel.s_prod_int t1,
    siebel.s_org_ext t2,
    siebel.s_asset t3,
    siebel.av_account t4,
    siebel.s_org_ext t5,
    siebel.s_prod_int_x t6,
    siebel.av_event t7
    WHERE t1.row_id = t6.par_row_id(+)
    AND t7.promotion_code = t1.part_num(+)
    AND t7.asset_id = t3.row_id(+)
    AND t3.owner_accnt_id = t5.par_row_id(+)
    AND t7.id = t2.par_row_id --- S_ORG_EXT_U3
    AND t7.id1 = t4.row_id(+)
    AND (t2.NAME = 'Nichole')
    ORDER BY t7.bot_id, t7.timestp

  • Help needed in query tuning

    Hi All,
    I am using the following queries in formula columns of a 6i report. The query count for these queries as seen from the trc file is very high, which is causing performance issues in the report.
    Can anyone please help me to tune these queries.
    SELECT ROUND (SUM (pld.denom_burdened_cost))
    FROM pa_project_asset_lines_v pl,
    gl_code_combinations glcc,
    pa_asset_line_details_v pld
    WHERE pl.project_asset_line_detail_id = pld.project_asset_line_detail_id
    AND glcc.code_combination_id = pl.cip_ccid
    AND transfer_status_code = 'T'
    AND pld.project_id = :b1
    AND glcc.segment2 = '131340'
    Query Count - 1579401
    SELECT SUM (DECODE (ei.system_linkage_function,
    'ST', DECODE (pa_security.view_labor_costs (:b1),
    'Y', ei.project_burdened_cost,
    NULL
    'OT', DECODE (pa_security.view_labor_costs (:b1),
    'Y', ei.project_burdened_cost,
    NULL
    ei.project_burdened_cost
    ) aa
    FROM pa_expenditure_items_all ei, pa_tasks t
    WHERE ei.project_id = :b1
    AND pa_expenditures_utils.get_latest_gl_date (ei.expenditure_item_id)
    BETWEEN :b4
    AND :b5
    AND ei.org_id = fnd_profile.VALUE ('ORG_ID')
    AND ei.project_id = t.project_id
    AND NVL (t.billable_flag, 'N') = 'N'
    Query Count - 1969414
    SELECT SUM (DECODE (ei.system_linkage_function,
    'ST', DECODE (pa_security.view_labor_costs (:b1),
    'Y', ei.project_burdened_cost,
    NULL
    'OT', DECODE (pa_security.view_labor_costs (:b1),
    'Y', ei.project_burdened_cost,
    NULL
    ei.project_burdened_cost
    ) aa
    FROM pa_cost_distribution_lines_all pcd,
    gl_code_combinations glcc,
    pa_expenditure_items_all ei,
    pa_tasks t
    WHERE ei.project_id = :b1
    AND pa_expenditures_utils.get_latest_gl_date (ei.expenditure_item_id)
    BETWEEN :b4
    AND :b5
    AND ei.org_id = fnd_profile.VALUE ('ORG_ID')
    AND pcd.dr_code_combination_id = glcc.code_combination_id
    AND glcc.segment2 != '131340'
    AND ei.project_id = pcd.project_id
    AND ei.expenditure_item_id = pcd.expenditure_item_id
    AND t.project_id = ei.project_id
    AND t.billable_flag = 'Y'
    Query Count - 1973901
    Regards,
    Shruti

    This statement
    SELECT SUM (DECODE (ei.system_linkage_function,
    'ST', DECODE (pa_security.view_labor_costs (:b1),
    'Y', ei.project_burdened_cost,
    NULL
    'OT', DECODE (pa_security.view_labor_costs (:b1),
    'Y', ei.project_burdened_cost,
    NULL
    ei.project_burdened_cost
    ) aa
    FROM pa_expenditure_items_all ei, pa_tasks t
    WHERE ei.project_id = :b1
    AND pa_expenditures_utils.get_latest_gl_date (ei.expenditure_item_id)
    BETWEEN :b4
    AND :b5
    AND ei.org_id = fnd_profile.VALUE ('ORG_ID')
    AND ei.project_id = t.project_id
    AND NVL (t.billable_flag, 'N') = 'N'uses at least 3 different functions inside the SQL.
    <ul><li>pa_security.view_labor_costs (:b1)</li>
    <li>fnd_profile.VALUE ('ORG_ID')</li>
    <li>pa_expenditures_utils.get_latest_gl_date (ei.expenditure_item_id)</li>
    </ul>
    Each function call might result in a context switch from SQL to pl/SQL and back. This is expensive and slow. For each line 4 functions are called. Which means 8 context switches per base line. In your case aproximately 16 million switches.
    You can try to avoid this context switch.
    The first and second function an be encapsulated in a with query wich should result in a single call. The logic in the second function should be rewritten iinto pure SQL.
    This can make a huge difference.
    example untested
    with singlerowdata as (select pa_security.view_labor_costs (:b1) v_labor_costs, fnd_profile.VALUE ('ORG_ID') profile_org_id from dual)
    SELECT SUM (DECODE (ei.system_linkage_function,
      'ST', DECODE (s.v_labor_costs,
        'Y', ei.project_burdened_cost,
        NULL
      'OT', DECODE (s.v_labor_costs,
      'Y', ei.project_burdened_cost,
      NULL
    ei.project_burdened_cost
    ) aa
    FROM pa_expenditure_items_all ei, pa_tasks t, singlerowdata s
    WHERE ei.project_id = :b1
    /* "the latest date can also be found with an analytic function, but there is not enough information to show how to do it here"
    This would potentially improve the performance even more. */
    AND (select max(datecolumn) from pa_expenditure_items x where x.id = ei.expenditure_item_id) BETWEEN :b4 AND :b5
    AND ei.org_id = s.profile_org_id
    AND ei.project_id = t.project_id
    AND NVL (t.billable_flag, 'N') = 'N'

Maybe you are looking for

  • Wipe FileVault 2 Drive

    I'm trying to completely wipe and reinstall Mountain Lion on an employee's laptop who has left. Disk utility won't let me wipe the drive unless I give it the decryption password. Is there a way to completely erase the volume to reinstall the OS?

  • Receiver JDBC  ERROR

    While I am Practicing Sameer Shadab Blog File to Jdbc ( XML file to MS- Access mdb file ) Connecting to MS Access using receiver JDBC Adapter (Without DSN) I am getting following Error.. JDBC adapter receiver channel cc_jdbc_receiver not initialized.

  • No extensions work at all, why?

    I have a CF multiserver setup with CF7, CF8, and CF9 all running on JRun. I have CFBuilder installed as plugins to a clean version of Eclipse 3.5 64-bit for OS X. I installed the basic extensions to map to the CF9 server. I also installed a couple fr

  • Values showing up as null in expression

    I have a page that allows the user to modify some info in 2 fields and after making the change the info then gets sent to a servlet that makes the update. Problem is that before it's sent to the servlet the parameters show up as null. It's an object

  • G/L's in production planning

    Dear all, i have on question kindly answer me if any one knows. in standared practies of (SAP) PRODUCTION PLANNING how maney G/L's has to be assigned and what are they. thanks in advance. best regards, irfan