Help needed!! XML Query-Identical Tag

I have the following xml content in a database field of type XMLTYPE.
Version:
Oracle9i Enterprise Edition Release 9.2.0.5.0
<configuration>
<atm>
<arg1>10</arg1>
<arg2>100</arg2>
<val>Q1</val>
<pack>
<arg1>256</arg1>
</pack>
</atm>
<atm>
<arg1>20</arg1>
<arg2>200</arg2>
<val>Q2</val>
<pack>
<arg1>1024</arg1>
</pack>
</atm>
</configuration>
How do I get the value "1024" from an identical tag "atm" using xpath query ?
To be specific:
select second-atm/pack/arg1.value from xml where second-atm.arg1.value=20
I am new to extractvalue and existsnode functions.
Any help is appreciated!

Thanks Sundar.
Got the reply from another member.
His Response follows
with qry as (
select '<configuration>
<atm>
<arg1>10</arg1>
<arg2>100</arg2>
<val>Q1</val>
<pack>
<arg1>256</arg1>
</pack>
</atm>
<atm>
<arg1>20</arg1>
<arg2>200</arg2>
<val>Q2</val>
<pack>
<arg1>1024</arg1>
</pack>
</atm>
</configuration>' xml from dual)
select XMLTYPE(xml).extract('/configuration/atm[position() = 2 and arg1="20"]/pack/arg1/text()') data from qry ;

Similar Messages

  • 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/

  • 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.

  • Need help on xml query.

    pls click here to sample of xml data
    http://pcls1.craftyclicks.co.uk/xml/rapidaddress?postcode=AA11AA
    I make the following query to retrive values of xml data
    select x1.org,x1.org2,x1.org3,x1.org4,x1.org5 from xml_data_tab x, xmltable('/CraftyResponse/address_data_paf_compact/thoroughfare/delivery_point' passing x.xml_data
    columns
    org varchar2(500) path 'organisation_name' ,org2 varchar2(500) path 'building_number',org3 varchar2(500) path 'building_name',
    org4 varchar2(500) path 'dependent_locality',org5 varchar2(500) path 'town') x1 ;
    This is the output ..
    org4 and org5 is emply can any one guide me what should i do in the script ..
    SQL> /
    ORG ORG2 ORG3 ORG4 ORG5
    THE BAKERY 1
    FILMS R US 3
    FAMILY BUT 7
    CHER
    BIG HOUSE
    17 LITTLE COTTAGE
    SQL> spool off
    Below is sample of xml
    <CraftyResponse>
    <address_data_paf_compact>
    <thoroughfare_count>1</thoroughfare_count>
    <thoroughfare>
    <delivery_point_count>5</delivery_point_count>
    <delivery_point>
    <organisation_name>THE BAKERY</organisation_name>
    <department_name/>
    <po_box_number/>
    <building_number>1</building_number>
    <sub_building_name/>
    <building_name/>
    <udprn>12345678</udprn>
    </delivery_point>
    <delivery_point>
    <organisation_name>FILMS R US</organisation_name>
    <department_name/>
    <po_box_number/>
    <building_number>3</building_number>
    <sub_building_name/>
    <building_name/>
    <udprn>12345679</udprn>
    </delivery_point>
    <delivery_point>
    <organisation_name>FAMILY BUTCHER</organisation_name>
    <department_name/>
    <po_box_number/>
    <building_number>7</building_number>
    <sub_building_name/>
    <building_name/>
    <udprn>12345680</udprn>
    </delivery_point>
    <delivery_point>
    <organisation_name/>
    <department_name/>
    <po_box_number/>
    <building_number/>
    <sub_building_name/>
    <building_name>BIG HOUSE</building_name>
    <udprn>12345681</udprn>
    </delivery_point>
    <delivery_point>
    <organisation_name/>
    <department_name/>
    <po_box_number/>
    <building_number>17</building_number>
    <sub_building_name/>
    <building_name>LITTLE COTTAGE</building_name>
    <udprn>12345682</udprn>
    </delivery_point>
    <dependent_thoroughfare_name/>
    <dependent_thoroughfare_descriptor/>
    <thoroughfare_name>HIGH</thoroughfare_name>
    <thoroughfare_descriptor>STREET</thoroughfare_descriptor>
    </thoroughfare>
    <double_dependent_locality/>
    <dependent_locality>CRAFTY VALLEY</dependent_locality>
    <town>BIG CITY</town>
    <postal_county>POSTAL COUNTY</postal_county>
    <traditional_county>TRADITIONAL COUNTY</traditional_county>
    <postcode>AA1 1AA</postcode>
    </address_data_paf_compact>
    </CraftyResponse>

    e.g.
    SQL> select x2.org
      2       , x2.org2
      3       , x2.org3
      4       , x1.org4
      5       , x1.org5
      6  from xmltable('/CraftyResponse/address_data_paf_compact'
      7         passing httpuritype('http://pcls1.craftyclicks.co.uk/xml/rapidaddress?postcode=AA11AA').getxml()
      8         columns org4 varchar2(20) path 'dependent_locality'
      9               , org5 varchar2(20) path 'town'
    10               , delivery_points xmltype path 'thoroughfare/delivery_point'
    11       ) x1
    12     , xmltable('/delivery_point'
    13         passing x1.delivery_points
    14         columns org  varchar2(20) path 'organisation_name'
    15               , org2 varchar2(20) path 'building_number'
    16               , org3 varchar2(20) path 'building_name'
    17       ) x2
    18  ;
    ORG                  ORG2                 ORG3                 ORG4                 ORG5
    THE BAKERY           1                                         CRAFTY VALLEY        BIG CITY
    FILMS R US           3                                         CRAFTY VALLEY        BIG CITY
    FAMILY BUTCHER       7                                         CRAFTY VALLEY        BIG CITY
                                              BIG HOUSE            CRAFTY VALLEY        BIG CITY
                         17                   LITTLE COTTAGE       CRAFTY VALLEY        BIG CITY

  • 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}

  • Help needed in installing Identity management 11.1.1.2

    Hi,
    I have installed Oracle Webcenter and SOA suite (11g) in single domain and also installed and conten server 10.1.3.4. All in a single machine. And I want to provide LDAP Identity store for custom applications/Spaces application with content management. I am in the process installing Identity management. I have the following issues
    1. Do I need to install all the 5 components of Identity suite?
    2. Due to performance reasons I want to install Idm suite on different machine. Can the webcenter application on machine1 be configured to use the identity services from machine2 ,consideing i created a new domain on machine2 that contains it identity servers with its own admin console/Fusion control?
    installation guide contains lot of options which i could not understand .Please help me in this regard.
    Thansk,
    indra

    resolved

  • 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

  • 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 Attributes based style mapping!

    Hello all, I am new in this Group. I've reviewed the contents which posted earlier. It is pretty good.
    I need a help from this script forum regarding on mapping the attribute based style mapping.
    like: <emphasis style="italic">Text</emphasis> to be mapped as Italic character style
          <emphasis style="bold">Text</emphasis> to be mapped as Bold character style
    Any one example of VBS / JS is enough, Your highly response / help will be appreciated.
    Thanks
    Guna

    Hi gunasekarant
    here I am giving you the sample XML and XSLT files this works fine
    XSLT
    <xsl:transform
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">
    <xsl:template match="root">
    <xsl:apply-templates/>
    </root>
    </xsl:template>
    <xsl:template
    <xsl:template match="emphasis[@style='bold']">
      <b><xsl:apply-templates/></b>
    </xsl:template>
    <xsl:template match="emphasis[@style='italic']">
      <i><xsl:apply-templates/></i>
    </xsl:template>
    </xsl:transform>
    XML
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <root>
    <emphasis style="italic">Text</emphasis>
          <emphasis style="bold">Text</emphasis>
    </root>
    I have no idea about XSLT for Docbook for downloading you can develop

  • Help with XML Query

    Hi,
    I want to create the follow XML from the DATA in my DB:
    <customer id="1234">
    <order>
    <date>01-01-2004</date>
    </order>
    <order>
    <date>01-01-2005</date>
    </order>
    </customer>
    My SQL query would like a bit like this (returns two rows):
    select * from
    from orders
    join customers on customerID =order_customerID
    where customerID = 1234
    Is there any way to represent the ABOVE resultant XML from an XmlSqlQuery.
    Currently all I managed to do was get two rows of data like this:
    select xmlelement("customer", xmlelement("order", xmlelement("date", o_datum))) AS "result"
    from orders
    join customers on customerID =order_customerID
    where customerID = 1234
    <customer id="1234">
    <order>
    <date>01-01-2004</date>
    </order>
    </customer>
    <customer id="1234">
    <order>
    <date>01-01-2004</date>
    </order>
    </customer>
    But this is NOT what I wanted. I want the customer tag once only.
    thx.
    Steve

    I think xmlagg is correct, I'd try:
    select xmlelement("customer", xmlelement("order", xmlagg(xmlelement("date", o_datum)))) ....

  • 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'

  • Help needed in query for Materialized View

    Hi,
    I want to create a materialized view which has some precalcultaed values.
    I have four dimension tables out of which one is a Time Dimension table with levels as Year->Quarter->Month.
    The precalculations are the moving averages and cummulative values of Sales Amt on the dimension values over a period of 4 Months.
    The dimension tables are Clients, Products, Channel, Time.
    Fact Table is Sales_Fact which will have the sales amount for different members of the dimension.
    Since my fact table is very huge, i want to create a materialized view where i could store the required calculated measures, here Moving Average of Sales Amt for each Client, Product, Channel dimensions over a period of 4 Months.
    Can anybody help with writing the query for this..Any help in this regard will be appreciated..
    Please give me suggestions for this..

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

  • Help needed for Graphical mapping.Tag only once produces

    Hello experts,
    I have a problem in my graphical mapping.This is the example:
    from each segment A in IDOC has to be made Tag A or Tag B in output XML.
    Segment A has a field USER_STATUS and if it is X than Tag B has to be made otherwise Tag A.
    Segment A is 0..9999999. occurence
    Tag A  0..unbounded
    Tag B 0..unbounded.
    I made a mapping
    mapping for Tag A:
    USER_STATUS -> mapwith default(empty)->length->EqualsA (with Constant =0)-> createif->Tag A
    for Tag B as following:
    USER_STATUS -> mapwith default(empty)->EqualsS (with Constant =X)-> createif->Tag B
    The problem is that in output XML, I have only one Tag A or B (depending on field USER_STATUS in first occurence of the segment) while in inbound IDOC 5 segments are with different value of the field: USER_STATUS.
    Does anyone idea to solve this problem!
    Thank you very much for your effort.
    King regards,
    Danijela Zivanovic

    HI,
    CAn you try this way,
    Use Maping Node UseOneAsMany for Tag B
    and pass 3 inputs as
    Constant[]----
    >
    USER_STATUS -> mapwith default(empty)->EqualsS (with Constant =X)----
    >
    USER_STATUS -> mapwith default(empty)->EqualsS (with Constant =X)----
    >
    Same way try for Tag A also.
    Thanks
    Swarup

  • Help needed - XML forms not displaying in my repository

    Hi all
    I could really do with some help here.  I have a custom XML form for news articles.  It works fine in the standard documents repository, but I have my iView pointing to a folder in my own CM repository.
    When a user tries to directly access the "show" form, instead of the form it displays the XML code.  Any ideas why this is?
    My CM repository is running the following services:
    layout, properties, svc_acl, tbp
    EP6SP14
    Thanks!  Chris

    Hello,
    I have the same problem. When I'm trying to create an XML file using XML form in the repository /etc, I get the following error:
    XML - Forms 
    Cannot create item e0977870-cf29-2d10-bb89-d00b5761268c.xml in collection /etc/public/; operation is not supported.
    When I do the same in repository /documents, it works fine.
    I think, I've made the neccesary settings for the repository (Form Based Publishing, ...).
    Any clues will be highly appreciated.
    Jiri

Maybe you are looking for

  • How to share library on same mac with two users

    please provide step by step instruction on how to share library for my two girls on the same computer. my older daughter already has itouch and library. Now for the holidays got younger one an itouch also and want to share the library. i am a novice

  • Production Order reservation deletion.

    Can I delete the production order resevration directly in the other than active version in apo ?

  • 12c on Win7 64-bit - ERROR Can't load IA 32-bit .dll on a AMD 64-bit platform'

    My experience is not with XP but with Windows 7 64-bit. with Java for 64-bit, I cannot run Net Config nor the DBCA. Initially this was the error I got ExceptionMSG: 'C:\Windows\System32\msvcr100.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

  • What is the steps for flash recovery of database

    pls tell us what sre the steps for the flash recovery of the database. how will we be do the auto recovery from flash recovery area...... rakesh

  • Voip Server

    Hi all,        Is it possible to connect Voip server via blackberry 8300 .       if possible,  How to connect and make calls through it. Any samples... With Regards  Karthik.J