Aggregating Records in an XMLType Instance

Hi,
I have a table that contains data similar to the sample below:
Col1  - Col2 - Col3 - Col4
1 - ABC - DEF - GHJ
1 - abc - def - ghj
2 - XYZ - UVW - RST
3 - KLM - NPQ - RST
I would like an SQL Statement that generates
<ROOT>
<REC COL1 = 1>
<COL2>ABC</COL2><COL3>DEF</COL3><COL4>GHJ</COL4>
<COL2>abc</COL2><COL3>def</COL3><COL4>ghj</COL4>
</REC>
<REC COL1 = 2>
<COL2>XYZ</COL2><COL3>UVW</COL3><COL4>RST</COL4>
</REC>
<REC COL1 = 3>
<COL2>KLM</COL2><COL3>NPQ</COL3><COL4>RST</COL4>
</REC>
</ROOT>
Thanks in anticipation

Ok, I found XMLAgg can solve this.

Similar Messages

  • Record sorting using integer properties in aggregated records

    This is regarding a clarification on how sorting works across within rolled up endeca records . We roll up endeca records to represent the complete record (product). We have price as a property available with every record and when rolled up along with price sorted (low to high), with in the aggregated record we get the least price. When we apply price sorting (high to low), we get highest price with in the aggregated product.
    we are looking for is the least price with in the aggregated record to be used for sorting High to Low. Any ideas if this can be done.
    Below is the example of how the data looks at record level.
    P1
    R1  3.35
    R2  3.25
    R3  2.85
    P2
    R1  2.35
    R2  3.45
    P3
    R1  3.45
    R2  4.65
    R3  3.25
    R4  3.95
    Currently Low to High brings (P2-2.35,P1-2.85,P3-3.25)
    Currently High to Low brings (P3-4.65,P2-3.45, P1-3.35)
    Expected  ---> High to Low (P3-3.25, P1-2.85, P2-2.35) The reverse order of current low to high

    Check the class java.util.Collections and its method sort().
    You may also want to have a look at java.util.Arrays.
    S&oslash;ren

  • PLSQL and XMLTYPE -- Trying to pass cursor record into a XMLTYPE query.

    Hi all --
    I'm trying to pass records from a cursor into a xmltype query, with no success. If i hard code what the cursor record is, it works just fine, but when I use cursor_rec.value, I think it is taking that strin literally. Here is a simple example of what i'm trying to do.
    Brief Background -- I have two tables (OPLAN, OPLAN_SUB_CONT) with an XMLTYPE column. OPLAN contains the bulk/main XML with about 30 elemets, while OPLAN_SUB_CONT contains the xml files which either inserts or updates any of the 30 elements. Instead of hard coding 30 statments to check each element, I created a cursor to cycle through the possible elements. If an element exists i do something , if not i go the next element.
    This returns null, using elements_rec.element_name in the query...
    declare
    cursor cur_get_elements is
    select element_name
    from oplan_element_attribs
    where parent_element='Transactions'
    and element_name='OPLAN_STATUS';
    elements_rec cur_get_elements%rowtype;
    v_element number;
    begin
    for elements_rec in cur_get_elements
    Loop
    dbms_output.put_line ('before extract');
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/elements_rec.element_name'))) p;
    if v_element =0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is null');
    elsif v_element > 0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is not null');
    end if;
    end loop;
    end;
    SQL> /
    before extract
    Element OPLAN_STATUS is null
    PL/SQL procedure successfully completed.
    If i hard code the element_name (elements_rec.element_name) on line 16 (line wraps) to "OPLAN_STATUS' i get desired results ... returns not null
    declare
    cursor cur_get_elements is
    select element_name
    from oplan_element_attribs
    where parent_element='Transactions'
    and element_name='OPLAN_STATUS';
    elements_rec cur_get_elements%rowtype;
    v_element number;
    begin
    for elements_rec in cur_get_elements
    Loop
    dbms_output.put_line ('before extract');
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/OPLAN_STATUS'))) p;
    if v_element =0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is null');
    elsif v_element > 0
    then dbms_output.put_line ('Element ' || elements_rec.element_name || ' is not null');
    end if;
    end loop;
    end;
    SQL> /
    before extract
    Element OPLAN_STATUS is not null
    PL/SQL procedure successfully completed.
    Any ideas?
    Thanks!

    I should try everything before posting! Sorry, got it to work...
    replaced ..
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/elements_rec.element_name'))) p;
    with
    select nvl(count(value(p)),0)
    into v_element
    from oplan_sub_content_xml oscx,
    table(xmlsequence(extract(SUBSCRIPTION_CONTENT,'Transactions/' || elements_rec.element_name || ''))) p;

  • PL/SQL Record Type to XMLType

    Hi,
    I wanted to convert a pl/sql record type automatically with just one command using xmltype.createXML but I am wondering if anyone out there has used it this way or whether it is possible. I can't find any examples anywhere, and I didn't really want to do the hard work of doing it one element at a time using xmlelement & xmlattributes :-).....
    e.g.,
    l_record emp%rowtype;
    l_xml xmltype;
    begin
    for l_record in (select * from emp)
    loop
    l_xml := xmltype.convertXML (l_record) ; --> is this possible?? I can do it on a cursor but it doesn't seem to like it if its a record type
    end loop;
    Thanks in anticipation.
    M
    Edited by: user12097147 on 3/11/2009 16:48

    You cannot pass just any record structure to a procedure and expects it to determine its structure and contents and give you XML in return.
    Also when you call XMLTYPE(), you are essentially instantiating an object - and calling the constructor method of that class. There are a number of constructors that have different parameter signatures.
    If you want XML from a table, then you should be using XML functions.. in the following fashion (there's a number of approaches you can use, depending on your requirements) :
    SQL> select xmlElement( "Employee", xmlForest(e.empno, e.ename,e.job) ) as XML from emp e order by e.empno;
    XML
    <Employee><EMPNO>7369</EMPNO><ENAME>SMITH</ENAME><JOB>CLERK</JOB></Employee>
    <Employee><EMPNO>7499</EMPNO><ENAME>ALLEN</ENAME><JOB>SALESMAN</JOB></Employee>
    <Employee><EMPNO>7521</EMPNO><ENAME>WARD</ENAME><JOB>SALESMAN</JOB></Employee>
    <Employee><EMPNO>7566</EMPNO><ENAME>JONES</ENAME><JOB>MANAGER</JOB></Employee>
    <Employee><EMPNO>7654</EMPNO><ENAME>MARTIN</ENAME><JOB>SALESMAN</JOB></Employee>
    <Employee><EMPNO>7698</EMPNO><ENAME>BLAKE</ENAME><JOB>MANAGER</JOB></Employee>
    <Employee><EMPNO>7782</EMPNO><ENAME>CLARK</ENAME><JOB>MANAGER</JOB></Employee>
    <Employee><EMPNO>7788</EMPNO><ENAME>SCOTT</ENAME><JOB>ANALYST</JOB></Employee>
    <Employee><EMPNO>7839</EMPNO><ENAME>KING</ENAME><JOB>PRESIDENT</JOB></Employee>
    <Employee><EMPNO>7844</EMPNO><ENAME>TURNER</ENAME><JOB>SALESMAN</JOB></Employee>
    <Employee><EMPNO>7876</EMPNO><ENAME>ADAMS</ENAME><JOB>CLERK</JOB></Employee>
    <Employee><EMPNO>7900</EMPNO><ENAME>JAMES</ENAME><JOB>CLERK</JOB></Employee>
    <Employee><EMPNO>7902</EMPNO><ENAME>FORD</ENAME><JOB>ANALYST</JOB></Employee>
    <Employee><EMPNO>7934</EMPNO><ENAME>MILLER</ENAME><JOB>CLERK</JOB></Employee>
    14 rows selected.

  • Locking on the aggregated records

    Hello BPS Experts,
    if the level contains the product group PG1. and the infocube records are product level P1,P2. during manual planning using the manual layout. are the records containing the P1 and P2 are locked ?
    Suggestions appreciated.
    Thanks,
    BWer

    Hello BWer,
    read the correponding How To Guide 'Locking of Transaction Data':
    https://websmp109.sap-ag.de/bi
    -> Services and Implementation
    -> How To ... Guides
    -> How To ... Guides BPS
    Regards,
    Gregor

  • Cube to Open Hub DB destination - Aggregation of records

    Hi Folks,
    I am puzzled with BW 7.0 open hub DB destination in regards to aggregation.
    In BW 3.5 open hub DB destination I got from the cube already aggregated records depending what which fields I select. E.g. cube has cal week/ cal month   but in infospoke only cal month selected I get only one record per month (not several ones -> one for each week of the month).
    In BW 7.0 open hub destination it seems to be different. Although Cal Week is not used in any transformation rule and not part of the destination defintion I still get all weeks of the month as single records. In theory not a problem if the records would be aggregated according the sematic key of the open hub destination db. But here an error is issues -> duplicated record short dump.
    So do I get it right that with BW 7.0 record aggregation e.g. Cal Week / Month  ---> Cal Month is not possible at all? Or do I something wrong?
    Will need to have an intermediate DSO in between or is there another way to get teh aggregation for open hub "direclty" working?
    This is quite a shortcoming of the open hub. Not mentioning the non-availability of nav_attributes + source only from cubes not from multiproviders ...  seems that the open hub in BW 7.0 got worse compared to BW 3.5
    Thanks for all replies in advance,
    Axel

    Hi Axel,
    We can use 0CALMONTH in open hub destination. In BI 7.0 we can not extract data from Multi Provider using Open Hub.
    But in BW 7.30 we have this functionality( using DTP we can extract data from multi provider to OHD).
    No need to use intermediate DSO, we can extract data directly from Info Cube.
    Please check the below documents.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/501f0425-350f-2d10-bfba-a2280f288c59?quicklink=index&overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5092a542-350f-2d10-50bd-fc8cb3902e2e?quicklink=index&overridelayout=true
    Regards,
    Venkatesh

  • Storing bigger xml records into XMLTYPE

    Hello Friends,
    We are trying to store XML records in Oracle 9i, using the 'XMLTYPE' object. We created the following table:
    SQL> desc mytable;
    Name Null? Type
    SOME_NBR NUMBER(9)
    MY_RECORD XMLTYPE
    We were able to store smaller records upto a certain size say around 2433 characters. Beyond this size, it is not accepting the records. The message given is:
    "ERROR:
    ORA-01756: quoted string not properly terminated"
    Could you please tell us how we can store bigger XML records into the XMLTYPE?

    Hi,
    I am facing problem with XMLType.getDOM().
    In my java program I am getting th error ...
    java.sql.SQLException: Bigger type length than Maximum0: oracle.xdb.XMLType.getDOM(XMLType.java:1524)
    Sample code is as follows...
    XMLType theXml = (XMLType) rs.getObject(2);
    Document accDOM = new DOMBuilder().build(theXml.getDOM());
    Please let me know what could be the resason for.
    Thanks in advance,
    -Jayaram.

  • How to improve performance of a query that is based on an xmltype table

    Dear Friends,
    I have a query that is pulling records from an xmltype table with 9000 rows and it is running very slow.
    I am using XMLTABLE command to retreive the rows. It is taking upto 30 minutes to finish.
    Would you be able to suggest how I can make it faster. Thanks.
    Below is the query.....
    INSERT INTO temp_sap_po_receipt_history_t
    (po_number, po_line_number, doc_year,
    material_doc, material_doc_item, quantity, sap_ref_doc_no_long,
    reference_doc, movement_type_code,
    sap_ref_doc_no, posting_date, entry_date, entry_time, hist_type)
    SELECT :pin_po_number po_number,
    b.po_line_number, b.doc_year,
    b.material_doc, b.material_doc_item, b.quantity, b.sap_ref_doc_no_long,
    b.reference_doc, b.movement_type_code,
    b.sap_ref_doc_no, to_date(b.posting_date,'rrrr-mm-dd'),
    to_date(b.entry_date,'rrrr-mm-dd'), b.entry_time, b.hist_type
    FROM temp_xml t,
    XMLTABLE(XMLNAMESPACES('urn:sap-com:document:sap:rfc:functions' AS "n0"),
    '/n0:BAPI_PO_GETDETAIL1Response/POHISTORY/item'
    PASSING t.object_value
    COLUMNS PO_LINE_NUMBER VARCHAR2(20) PATH 'PO_ITEM',
    DOC_YEAR varchar2(4) PATH 'DOC_YEAR',
    MATERIAL_DOC varchar2(30) PATH 'MAT_DOC',
    MATERIAL_DOC_ITEM VARCHAR2(10) PATH 'MATDOC_ITEM',
    QUANTITY NUMBER(20,6) PATH 'QUANTITY',
    SAP_REF_DOC_NO_LONG VARCHAR2(20) PATH 'REF_DOC_NO_LONG',
    REFERENCE_DOC VARCHAR2(20) PATH 'REF_DOC',
    MOVEMENT_TYPE_CODE VARCHAR2(4) PATH 'MOVE_TYPE',
    SAP_REF_DOC_NO VARCHAR2(20) PATH 'REF_DOC_NO',
    POSTING_DATE VARCHAR2(10) PATH 'PSTNG_DATE',
    ENTRY_DATE VARCHAR2(10) PATH 'ENTRY_DATE',
    ENTRY_TIME VARCHAR2(8) PATH 'ENTRY_TIME',
    HIST_TYPE VARCHAR2(5) PATH 'HIST_TYPE') b;

    Based on response from mdrake on this thread:
    Re: XML file processing into oracle
    For large XML's, you can speed up the processing of XMLTABLE by using a registered schema...
    declare
      SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
      XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
            <xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
            <xs:complexType name="groupType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="item" type="itemType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="id" type="xs:byte" use="required"/>
            </xs:complexType>
            <xs:complexType name="itemType" xdb:maintainDOM="false">
                    <xs:simpleContent>
                            <xs:extension base="xs:string">
                                    <xs:attribute name="id" type="xs:short" use="required"/>
                                    <xs:attribute name="name" type="xs:string" use="required"/>
                            </xs:extension>
                    </xs:simpleContent>
            </xs:complexType>
            <xs:complexType name="cust_orderType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="group" type="groupType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="cust_id" type="xs:short" use="required"/>
            </xs:complexType>
         </xs:schema>';
      INSTANCE  CLOB :=
    '<cust_order cust_id="12345">
      <group id="1">
        <item id="1" name="Standard Mouse">100</item>
        <item id="2" name="Keyboard">100</item>
        <item id="3" name="Memory Module 2Gb">200</item>
        <item id="4" name="Processor 3Ghz">25</item>
        <item id="5" name="Processor 2.4Ghz">75</item>
      </group>
      <group id="2">
        <item id="1" name="Graphics Tablet">15</item>
        <item id="2" name="Keyboard">15</item>
        <item id="3" name="Memory Module 4Gb">15</item>
        <item id="4" name="Processor Quad Core 2.8Ghz">15</item>
      </group>
      <group id="3">
        <item id="1" name="Optical Mouse">5</item>
        <item id="2" name="Ergo Keyboard">5</item>
        <item id="3" name="Memory Module 2Gb">10</item>
        <item id="4" name="Processor Dual Core 2.4Ghz">5</item>
        <item id="5" name="Dual Output Graphics Card">5</item>
        <item id="6" name="28inch LED Monitor">10</item>
        <item id="7" name="Webcam">5</item>
        <item id="8" name="A3 1200dpi Laser Printer">2</item>
      </group>
    </cust_order>';                
    begin
      dbms_xmlschema.registerSchema
         schemaurl       => SCHEMAURL
        ,schemadoc       => XMLSCHEMA
        ,local           => TRUE
        ,genTypes        => TRUE
        ,genBean         => FALSE
        ,genTables       => TRUE
        ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
      execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
    end;
    SQL> desc CUST_ORDER_TBL
    Name                                                                                                                                    Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
    SQL> set autotrace on explain
    SQL> set pages 60 lines 164 heading on
    SQL> col cust_id format a8
    SQL> select extract(object_value,'/cust_order/@cust_id') as cust_id
      2        ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
      3  from   CUST_ORDER_TBL
      4        ,XMLTABLE('/cust_order/group'
      5                  passing object_value
      6                  columns id   number       path '@id'
      7                         ,item xmltype      path 'item'
      8                 ) grp
      9        ,XMLTABLE('/item'
    10                  passing grp.item
    11                  columns id   number       path '@id'
    12                         ,inm  varchar2(30) path '@name'
    13                         ,qty  number       path '.'
    14                 ) itm
    15  /
    CUST_ID    GROUP_ID    ITEM_ID ITEM_NAME                        ITEM_QTY
    12345             1          1 Standard Mouse                        100
    12345             1          2 Keyboard                              100
    12345             1          3 Memory Module 2Gb                     200
    12345             1          4 Processor 3Ghz                         25
    12345             1          5 Processor 2.4Ghz                       75
    12345             2          1 Graphics Tablet                        15
    12345             2          2 Keyboard                               15
    12345             2          3 Memory Module 4Gb                      15
    12345             2          4 Processor Quad Core 2.8Ghz             15
    12345             3          1 Optical Mouse                           5
    12345             3          2 Ergo Keyboard                           5
    12345             3          3 Memory Module 2Gb                      10
    12345             3          4 Processor Dual Core 2.4Ghz              5
    12345             3          5 Dual Output Graphics Card               5
    12345             3          6 28inch LED Monitor                     10
    12345             3          7 Webcam                                  5
    12345             3          8 A3 1200dpi Laser Printer                2
    17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
    On 10.2.0.1:
    Execution Plan
    Plan hash value: 3741473841
    | Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   1 |  NESTED LOOPS                      |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   2 |   NESTED LOOPS                     |                        |     3 | 11460 |   805   (1)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL               | CUST_ORDER_TBL         |     1 |  3777 |     3   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN                | SYS_IOT_TOP_774117     |     3 |   129 |     1   (0)| 00:00:01 |
    |   5 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    Predicate Information (identified by operation id):
       4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
           filter("SYS_NC_TYPEID$" IS NOT NULL)
    Note
       - dynamic sampling used for this statementOn 10.2.0.3:
    Execution Plan
    Plan hash value: 1048233240
    | Id  | Operation               | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   1 |  NESTED LOOPS           |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   2 |   MERGE JOIN CARTESIAN  |                   |    17 |   131K|   805   (0)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL    | CUST_ORDER_TBL    |     1 |  3781 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                   |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_56152 |     1 |    43 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C006701       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
       6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
           filter("SYS_NC_TYPEID$" IS NOT NULL AND
                  "NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
       7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
    Note
       - dynamic sampling used for this statement----------------------------------------------------------------------------------------------------------
    -- CLEAN UP
    DROP TABLE CUST_ORDER_TBL purge;
    exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd');

  • Difference between  aggregation and calculation tab in BEx Query Designer

    HI,
    I am using BEx Query Designer for my report, for the key figures in the coloumn area i slected one numeric key figures, in  the properties tab i found aggregation tab and calculation tab.
    I need to sum up the total values for that particualar coloumn, when i used calculation tab i found to sum all the values for a particular coloumn, then what is the use the aggreagation tab?
    I not able to used that Aggregation tab it is showing as a hidden fields...
    can any one tell me whats the exact difference between these tabs and when we need to use which tab?
    With Regards,
    Thanesh Kumar.

    Hi Thanesh Kumar,
    I moved this thread from forum Data Warehousing to Business Explorer since it is a query related question (as SDN moderator).
    I could explain to you the difference between these two tabs.
    For "calculation" tab, it changes the display of result and does not change the calculation logic.
    It means that, if this key figure is used further in formula, still the original number (without "calculation" tab setting)  is used for further formula calculation.
    For "aggregation" tab, it changes the real calculation logic.
    The system takes the setting as the aggregation rule for records.
    The most common aggregation rule is of course summation. If you set to e.g. Average here, the system does the
    Average instead of summation when aggregating records. And the Average value will be taken for calculation
    in further formulas or other calculations.
    For "aggregation" tab, you could only use it for CKF (calculated key figure) or formula and you could not use it for
    a basic key figure. That should be the reason why you see it greyed-out.
    Regards,
    Patricia

  • Combining 2 records in a single cube

    Hi Everyone,
    I would like to get your opinion about this particular requirement.
    I have an opportunities cube (CRM) which stores info about different opportunities. One customer may go from one opportunity to another. Both the opportunities are saved as different records in BW for instance Oppt A (Record 1)and Oppt B (Record 2)
    So now client wants to see in a single record, which customer went from Oppt A to Oppt B.
    I am thinking about creating another cube and write a routine to check the Bill Account ( which is the only field available linking the 2 opportunities.
    Is this possible? Has anyone encountered or made such a routine?
    have you got other ways of doing this?
    Your inputs will be greatly appreciated.
    Thanks
    Kumar.

    Hi Vamsi,
    Thanks for your offer to help with the coding. That wont be necessary anymore as I figured out I will not be able to join the 2 records since there is a One to Many relationship between Oppt A and Oppt B. I will just display them as different records and sort them together.
    But since we have this idea of combining 2 records of a single cube, why don't we continue and close this.
    If there was a 1 to 1 Rel, the records would have shown this way
    Oppt A
    Bill Account
    Meter ID
    Transaction no
    Customer Name
    Address
    AutoDR Flag (Checked)
    Load Approved
    Oppt B
    Bill Account
    Meter ID
    Transaction no
    Customer Name
    Address
    TI Indicator Flag (Checked)
    Campaign Enrolled
    The Key fields would have been Bill Account and Meter ID
    So the final Oppt would have been ...
    Bill Account
    Meter ID
    Transaction no
    Customer Name
    Address
    AutoDR Flag (Checked)
    Load Approved
    TI Indicator Flag (Checked)
    Campaign Enrolled

  • Duplicate Instances in cube_instances with same root_id , parent_Id

    Environment - We are having a 2 node cluster installation of SOA SUITE 10.1.3.4, MLR-
    We have a file poller (say ESB_poller) and for each record in the file we call a BPEL Process (say BPEL_parent) which call another BPEL process (say BPEL_child). BPEL_child calls a PL/SQL procedure which basicall does an insertion of each record in the DB.
    PROBLEM - We have observed that when 2 to 3 large file containing 3000 records each is fed to the system, then sometimes, for 5 to 10 records we have 2 instances of BPEL_child process. They have the same root id and same parent id in CUBE_INSTANCE. One of them gives an error with primary key violation error while inserting in the DB. But the audit trail in BPEL Console for BPEL_parent shows only 1 instance of BPEL_child which has errored and hence our instance goes for exception handling (business perspective).
    Could someone tell us,
    1. WHY ARE THERE TWO INSTANCES OF BPEL_CHILD PROCESS?
    2. UNDER WHAT SCENARIO WE SHOULD EXPECT THIS?
    3. WHY AREN'T BOTH THE INSTANCE SHOWING IN BPEL CONSOLE?
    4. HOW TO HANDLE THIS SCENARIO/ THE WORKAROUND?
    NOTE : Call to child process is synch.
    Fault policy is as follows for the process -
    <Conditions>
              <!-- Fault if wsdlRuntimeLocation is not reachable -->
              <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:remoteFault">
                   <condition>
                        <action ref="ora-rethrow-fault"/>
                   </condition>
              </faultName>
              <!-- Fault if location port is not reachable-->
              <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:bindingFault">
                   <condition>
                        <action ref="ora-rethrow-fault"/>
                   </condition>
              </faultName>
         </Conditions>

    Hi,
    This is a problem with the clustered environment...add clusterGroupId to your file adapter activation agent to make sure only one activation agent is active at anytime in the clustered environment.
    Have a luk at this link:Duplicate instance created in BPEL

  • Joining 2 related records using PL SQL in Apex - Problems when there are more than 2 related records?

    Hi
    I am combining 2 related records of legacy data together that make up a marriage record.  I am doing this in APEX using a before header process using the following code below which works well when there are only 2 related records which joins the bride and groom record together on screen in apex.  I have appended a field called principle which is set to 'Y' for the groom and 'N' for the bride to this legacy data
    However there are lots of records where in some instances there are 3, 4 , 5, 6 or even 1 record which causes the PL/SQL in APEX to not return the correct data.  The difference in these related columns is that the name of the bride or groom could be different but it is the same person, its just that from the old system if a person had another name or was formally known as they would create another duplicate record for the marriage with the different name, but the book and entry number is the same as this is unique for each couple who get married.
    How can I adapt the script below so that if there are more than 2 records that match the entry and book values then it will display a message or is there a better possible work around?  Cleaning the data would be not an option as there are thousands of rows of where these occurrences occur
    declare 
         cursor c_mar_principle(b_entry in number, b_book in varchar2) 
         is 
              select DISTINCT  id, forename, surname, marriagedate, entry, book,  formername, principle
              from   MARRIAGES mar 
              where  mar.entry   = b_entry
              and    mar.book = b_book
              order by principle desc, id asc; 
         rec c_mar_principle%rowtype;
    begin 
    open c_mar_principle(:p16_entry,:p16_book)  ;
    fetch c_mar_principle into rec;
    :P16_SURNAME_GROOM   := rec.surname; 
    :P16_FORNAME_GROOM   := rec.forename;
                   :P16_ENTRY := rec.entry; 
                   :P16_BOOK :=rec.book;
    :P16_FORMERNAME :=rec.formername;
    :P16_MARRIAGEDATE :=rec.marriagedate;
    :P16_GROOMID  := rec.id;
    fetch c_mar_principle into rec;
    :P16_SURNAME_BRIDE   := rec.surname; 
    :P16_FORNAME_BRIDE   := rec.forename;
                   :P16_ENTRY := rec.entry; 
                   :P16_BOOK :=rec.book;
    :P16_FORMERNAME :=rec.formername;
    :P16_MARRIAGEDATE :=rec.marriagedate;
    :P16_BRIDEID  := rec.id;
    close c_mar_principle;
    end;

    rambo81 wrote:
    True but that answer is not really helping this situation either?
    It's indisputably true, which is more than can be said for the results of querying this data.
    The data is from an old legacy flat file database that has been exported into a relational database.
    It should have been normalized at the time it was imported.
    Without having to redesign the data model what options do I have in changing the PL/SQL to cater for multiple occurances
    In my professional opinion, none. The actual problem is the data model, so that's what should be changed.

  • Different output XMLTRANSFORM and XMLTYPE.TRANSFORM

    Hi,
    we upgrade from 10gR2 to 11gR2 and still have problems with XML transformation. Under unknown circumstances the XMLTRANSFORM function
    fails with "LPX-00660: Not a well-formed document or external entity" when the count of Page elements is greater then one.
    It seems, this bug isnt fixed in 11gR2...
    SET SCAN OFF
    DECLARE
      xml     XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
    <FILE>
      <DOCUMENT>
        <PAGE>
          <b101f>Hello</b101f>
          <b101>World</b101>
          <f101/>
          <REGARDS/>
        </PAGE>
      </DOCUMENT>
      <DOCUMENT>
        <PAGE>
          <list_layout xpos="10" lsign="+"/>
          <le>May</le>
          <le>the</le>
          <le stil="f">force</le>
          <le>be</le>
          <le>with</le>
          <le>you</le>
          <f101/>
          <REGARDS/>
        </PAGE>
      </DOCUMENT>
    </FILE>
      xsl     XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" omit-xml-declaration="yes"/>
      <xsl:template match="node()|@*">
        <xsl:copy>
          <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="FILE">
        <FILE>
          <xsl:apply-templates/>
        </FILE>
      </xsl:template>
      <xsl:template match="DOCUMENT">
        <DOCUMENT>
          <xsl:apply-templates/>
        </DOCUMENT>
      </xsl:template>
      <xsl:template match="PAGE">
        <PAGE>
          <CONTENT>
            <xsl:apply-templates/>
          </CONTENT>
        </PAGE>
      </xsl:template>
      <xsl:template match="REGARDS">
        <xsl:text disable-output-escaping="yes">&#38;lt;lt;b101&#38;lt;gt;Best regards&#38;lt;lt;/b101&#38;lt;gt;</xsl:text>
      </xsl:template>
    </xsl:stylesheet>
      buf   VARCHAR2(32767 CHAR);
    BEGIN
      DBMS_OUTPUT.PUT_LINE(xml.transform(xsl).getClobVal());
      SELECT  xmltransform(xml, xsl).getStringVal()
      INTO    buf
      FROM    dual;
      DBMS_OUTPUT.PUT_LINE(buf);
    END;
    /Oracle Docu: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb08tra.htm
    XMLType instance can be transformed in the following ways:
    Using Oracle SQL function XMLtransform or XMLType method transform() in the database.
    Using Oracle XML Developer's Kit transformation options in the middle tier, such as XSLT Processor for Java.
    You can alternatively use XMLType method transform() as an alternative to Oracle SQL function XMLtransform. It has the same functionality.
    Output:
    <FILE>
    <DOCUMENT>
    <PAGE>
    <CONTENT>
    <b101f>Hello</b101f>
    <b101>World</b101>
    <f101/>&#38;lt;lt;b101&#38;lt;gt;Best regards&#38;lt;lt;/b101&#38;lt;gt;</CONTENT>
    </PAGE>
    </DOCUMENT>
    <DOCUMENT>
    <PAGE>
    <CONTENT>
    <list_layout xpos="10" lsign="+"/>
    <le>May</le>
    <le>the</le>
    <le stil="f">force</le>
    <le>be</le>
    <le>with</le>
    <le>you</le>
    <f101/>&#38;lt;lt;b101&#38;lt;gt;Best regards&#38;lt;lt;/b101&#38;lt;gt;</CONTENT>
    </PAGE>
    </DOCUMENT>
    </FILE>
    <FILE><DOCUMENT><PAGE><CONTENT><b101f>Hello</b101f><b101>World</b101><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT><DOCUMENT><PAGE><CONTENT><list_layout xpos="10" lsign="+"></list_layout><le>May</le><le>the</le><le stil="f">force</le><le>be</le><le>with</le><le>you</le><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT></FILE>

    Hi,
    we upgrade from 10gR2 to 11gR2 and still have problems with XML transformation. Under unknown circumstances the XMLTRANSFORM function
    fails with "LPX-00660: Not a well-formed document or external entity" when the count of Page elements is greater then one.
    It seems, this bug isnt fixed in 11gR2...
    SET SCAN OFF
    DECLARE
      xml     XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
    <FILE>
      <DOCUMENT>
        <PAGE>
          <b101f>Hello</b101f>
          <b101>World</b101>
          <f101/>
          <REGARDS/>
        </PAGE>
      </DOCUMENT>
      <DOCUMENT>
        <PAGE>
          <list_layout xpos="10" lsign="+"/>
          <le>May</le>
          <le>the</le>
          <le stil="f">force</le>
          <le>be</le>
          <le>with</le>
          <le>you</le>
          <f101/>
          <REGARDS/>
        </PAGE>
      </DOCUMENT>
    </FILE>
      xsl     XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" omit-xml-declaration="yes"/>
      <xsl:template match="node()|@*">
        <xsl:copy>
          <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="FILE">
        <FILE>
          <xsl:apply-templates/>
        </FILE>
      </xsl:template>
      <xsl:template match="DOCUMENT">
        <DOCUMENT>
          <xsl:apply-templates/>
        </DOCUMENT>
      </xsl:template>
      <xsl:template match="PAGE">
        <PAGE>
          <CONTENT>
            <xsl:apply-templates/>
          </CONTENT>
        </PAGE>
      </xsl:template>
      <xsl:template match="REGARDS">
        <xsl:text disable-output-escaping="yes">&#38;lt;lt;b101&#38;lt;gt;Best regards&#38;lt;lt;/b101&#38;lt;gt;</xsl:text>
      </xsl:template>
    </xsl:stylesheet>
      buf   VARCHAR2(32767 CHAR);
    BEGIN
      DBMS_OUTPUT.PUT_LINE(xml.transform(xsl).getClobVal());
      SELECT  xmltransform(xml, xsl).getStringVal()
      INTO    buf
      FROM    dual;
      DBMS_OUTPUT.PUT_LINE(buf);
    END;
    /Oracle Docu: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb08tra.htm
    XMLType instance can be transformed in the following ways:
    Using Oracle SQL function XMLtransform or XMLType method transform() in the database.
    Using Oracle XML Developer's Kit transformation options in the middle tier, such as XSLT Processor for Java.
    You can alternatively use XMLType method transform() as an alternative to Oracle SQL function XMLtransform. It has the same functionality.
    Output:
    <FILE>
    <DOCUMENT>
    <PAGE>
    <CONTENT>
    <b101f>Hello</b101f>
    <b101>World</b101>
    <f101/>&#38;lt;lt;b101&#38;lt;gt;Best regards&#38;lt;lt;/b101&#38;lt;gt;</CONTENT>
    </PAGE>
    </DOCUMENT>
    <DOCUMENT>
    <PAGE>
    <CONTENT>
    <list_layout xpos="10" lsign="+"/>
    <le>May</le>
    <le>the</le>
    <le stil="f">force</le>
    <le>be</le>
    <le>with</le>
    <le>you</le>
    <f101/>&#38;lt;lt;b101&#38;lt;gt;Best regards&#38;lt;lt;/b101&#38;lt;gt;</CONTENT>
    </PAGE>
    </DOCUMENT>
    </FILE>
    <FILE><DOCUMENT><PAGE><CONTENT><b101f>Hello</b101f><b101>World</b101><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT><DOCUMENT><PAGE><CONTENT><list_layout xpos="10" lsign="+"></list_layout><le>May</le><le>the</le><le stil="f">force</le><le>be</le><le>with</le><le>you</le><f101></f101><b101>Best regards</b101></CONTENT></PAGE></DOCUMENT></FILE>

  • What class is Record in?

    Anyone out there know what class a Record object is in? What do I need to import to use it? Thanks.

    Umm... a Record object is an instance of the Record class, of course. If you're wondering what package the Record class is in, I didn't see any mention of a Record class in the standard API for JDK 1.4 or for JDBC. Perhaps your instructor created the class, in which case you'll have to ask him/her.

  • ORA-03113 when inserting a CLOB value casted as an XMLType from a SELECT query into a table

    I have a table that contains a CLOB column with pseudo-XML in it. I want to keep this data in an XMLType column so that I can leverage some of Oracle's built-in XML features to parse it more easily.
    The source table is defined as:
    CREATE TABLE "TSS_SRM_CBEBRE_LOGS_V"
    ( "INCIDENT_ID" NUMBER,
    "EVENT_TYPE" VARCHAR2(100 BYTE) NOT NULL ENABLE,
    "EVENT_KEY" VARCHAR2(100 BYTE),
    "CREATION_DATE" TIMESTAMP (6) NOT NULL ENABLE,
    "CREATED_BY" VARCHAR2(100 BYTE) NOT NULL ENABLE,
    "LOG_MSG" CLOB);
    The target (for testing this problem) table is defined as:
    CREATE TABLE "TESTME"
    ( "LOG_MSG" "XMLTYPE"
    My query is:
    insert /*+ APPEND */ into testme ("LOG_MSG")
    select XMLTYPE.createXML("LOG_MSG") as LOG_MSG from "TSS_SRM_CBEBRE_LOGS_V" b;
    In SQL*Developer, my error is: Error report:
    SQL Error: No more data to read from socket
    In SQL*PLUS and Toad, my error is:
    ORA-03113: end-of-file on communication channel
    Process ID: 13903
    Session ID: 414 Serial number: 32739

    By pseudo-XML, I mean that it doesn't have the xml root node. The content structure is similar to the following:
    <a attr1="1" attr2="2" />
    <b attr1="3" attr2="4" />
    <c attr1="5">
    <e attr1="6" attr2="7" />
    <e attr1="8" attr2="9" />
    <e attr1="10" attr2="11" />
    </c>
    <d attr1="12" />
    OK. Those are XML fragments then.
    I'm surprised you say the query alone works.
    We cannot build an XMLType instance using the default constructor or createXML() method when the content is composed of fragments.
    AFAIK the only option is to use XMLParse() with CONTENT option :
    SQL> select xmltype.createxml(LOG_MSG) from TSS_SRM_CBEBRE_LOGS_V;
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00245: extra data after end of document
    Error at line 2
    ORA-06512: at "SYS.XMLTYPE", line 5
    no rows selected
    SQL> select xmltype(LOG_MSG) from TSS_SRM_CBEBRE_LOGS_V;
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00245: extra data after end of document
    Error at line 2
    ORA-06512: at "SYS.XMLTYPE", line 272
    ORA-06512: at line 1
    no rows selected
    SQL> select xmlparse(content LOG_MSG) from TSS_SRM_CBEBRE_LOGS_V;
    XMLPARSE(CONTENTLOG_MSG)
    <a attr1="1" attr2="2" />
    <b attr1="3" attr2="4" />
    <c attr1="5">
    <e attr1="6" a
    Anyway, you'll eventually hit this :
    SQL> insert into testme (LOG_MSG)
      2  select XMLparse(content LOG_MSG)
      3  from TSS_SRM_CBEBRE_LOGS_V;
    insert into testme (LOG_MSG)
    ERROR at line 1:
    ORA-19010: Cannot insert XML fragments

Maybe you are looking for

  • The App Store shuts down when trying to search

    I'll be searching something in the App Store and then it randomly shuts down. I have tried restarting multiple times and that did nothing. This has never happened before and only happened when I got iOS 6. Someone please help!

  • DEP preventing Itunes from automatic sync with ipod

    I can't find anything about this anywhere so you might be able to help me! I changed the podcast automatic sync settings on my ipod and for some inexplicable reaon, the ipod (160gb classic) started sncing manually with itunes. (i'm pretty sure i didn

  • Excess Report

    Which report or module can I use to get all the exCess material and dead stock ? Thanks Polo Ramirez [email protected]

  • Script / Smartforms

    Hi all,        Can Anyone Tell me <b>the Script /SMartforms</b> Names For The Below mentioned items <b>Sales and distribution:</b> Quotation Print out sale order print out delivery note print out excise invoice print out performance guarantee. <b>FI:

  • Actionscript 3 and navigateToUrl Method

    Hi All, I have a flash file with some buttons to open web addresses , I have made xml file to store my URL and then read them and parse them and assign the buttons functions to open url: btnRadio.addEventListener(MouseEvent.CLICK, function() { naviga