Updating a very large xmltype table in xmldb

Hi,
I am working on storing a large collection of xml files inside XMLDB (Oracle 10g database). I choose to use the object-relational storage instead of CLOB storage because of the type of queries that have to be performed on this database. The files were loaded successfully into an xmltype table and currently there are more than15million records in the database. I have built functional indexes and text index to improve query performance.
I would like to know the best way to run regular updates on this database(about once in every two weeks). The update xml files(Five 40MB files with 10,000 records each) contain both old records to be updated and new records to be inserted.
Each record has a unique id element which can be used in checking to see if it already exists in the database. So the update procedure would require a select on the database to check and see if the record already exists and then update if it exists or insert if it does not.
Any ideas on how to acheive this within a reasonable amount of time will be greatly appreciated.
Thanks,
Uma

Thanks Mark,
I have modified the SAXLoader to use a stored procedure inside Oracle which would insert/update as the case may be. It's taking 10 minutes to load a single update file (50MB in size with 10,000 xml records). I have built a text index on this table and it takes 20 to 30 minutes to synchronize the index. I am relatively new to XMLDB and text indexing, and was wondering if there's a way to speed up this process.
Thanks once again,
Uma

Similar Messages

  • Deleting data from a very large log table (custom table in our namespace)

    Hello,
    I have been tasked with clearing a log table in our landscape to only include the most recent entries.  Is it possible to do this given that the table has already got 230 000 000 entries and will need to keep around 600 000 recent entries?
    Should I do this via ABAP and if so, how?  Thanks,
    Samir

    Hi,
    so you are going to keep 0,3 % of your data?
    If you should do it in ABAP or on the database is your decission.
    In my opinion doing things on the database directly should be done
    exceptional cases only e.g. for one time actions or actions that have to
    be done very rarely and with different parameters / options. Regular
    and similar tasks should be done in ABAP i think.
    In any case i would not delete the majority of the records but copy
    the records to keep in an empty table with the same structure, delete the
    table as a whole (check clients!) and "copy" the new table back in ABAP
    or rename the new table to the old table after droping the old table on the database.
    If you have only one client you can copy the data you need in a new
    table and truncate the old table (fast deletion for all clients). If you have
    data to keep  for other clients as well check how much data it is per client
    in comparison to the total number of lines (if only a small fraction, pefer copying
    them too).
    On the database you can use CTAS (create table as select) and drop table and
    rename table. Those commands shoudl be very efficient but work client independently.
    If you have to consider clients SELECT; INSERT; DELETE or TRUNCATE (depends on if you have
    copied all data considering clients) are
    your friends.
    Kind regards,
    Hermann

  • How to process very large internal tables and stop time limit

    Hello Experts,
    I am currently having a problem on how to fix a certain report where we process more than 500 thousand
    records in the internal table. I can't think of any solution that can make the below code any faster.
    I just checked in our prod server and the error time limit exceeded stops in the loop statement. Anyway,
    Below is the code. Any input will be appreciated. Thanks guys and take care!
    Get sales document and corresponding line item
      SELECT avbeln bposnr a~auart
             avkorg avtweg a~kunnr
             bmatnr bpstyv b~spart
        FROM vbak AS a
       INNER JOIN vbap AS b
          ON avbeln = bvbeln
       APPENDING TABLE lt_vbap
       WHERE a~auart IN lr_auart
         AND a~vbeln IN s_vbeln
         AND a~vbeln IN s_vbill
         AND a~vbtyp EQ p_vbtyp.
      LOOP AT lt_vbap ASSIGNING <wa_vbap>.
        IF <wa_vbap>-auart EQ 'ZUCI' OR
           <wa_vbap>-auart EQ 'ZURV' OR
           <wa_vbap>-auart EQ 'ZUPR'.
        Check ifa delivery document has been created
          CLEAR wa_vbill.
          SELECT SINGLE vbeln
            FROM vbfa
            INTO wa_vbill
           WHERE vbelv = <wa_vbap>-vbeln
             AND ( ( vbtyp_n EQ 'J' AND vbtyp_v = 'C' )
              OR ( vbtyp_n EQ 'T' AND vbtyp_v = 'H' ) ).
          IF sy-subrc <> 0.
            <wa_vbap>-del_ind = 'X'.
            CONTINUE.
          ELSE.
          Check if within selection parameters
            CLEAR wa_likp.
            READ TABLE lt_likp INTO wa_likp WITH KEY vbeln = wa_vbill.
            IF sy-subrc <> 0.
              SELECT SINGLE *
                FROM likp
                INTO wa_likp
               WHERE vbeln = wa_vbill.
              APPEND wa_likp TO lt_likp.
            ENDIF.
            IF NOT wa_likp-wadat_ist IN s_erdat.
              <wa_vbap>-del_ind = 'X'.
              CONTINUE.
            ENDIF.
          ENDIF.
        ELSE.
      Check if this has already been billed
          CLEAR wa_vbill.
          SELECT SINGLE vbeln
            FROM vbfa
            INTO wa_vbill
           WHERE vbelv = <wa_vbap>-vbeln
             AND ( ( vbtyp_n EQ 'M' AND vbtyp_v = 'C' )
              OR ( vbtyp_n EQ 'O' AND vbtyp_v = 'H' ) ).
          IF sy-subrc <> 0.
            <wa_vbap>-del_ind = 'X'.
            CONTINUE.
          ELSE.
          Check if within selection parameters
            CLEAR wa_vbrk.
            READ TABLE lt_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbill.
            IF sy-subrc <> 0.
              SELECT SINGLE vbeln fkdat
                FROM vbrk
                INTO wa_vbrk
               WHERE vbeln = wa_vbill.
              APPEND wa_vbrk TO lt_vbrk.
            ENDIF.
            IF NOT wa_vbrk-fkdat IN s_erdat.
              <wa_vbap>-del_ind = 'X'.
              CONTINUE.
            ENDIF.
          ENDIF.
        ENDIF.
      Get Material Type and Division
        IF <wa_vbap>-spart IS NOT INITIAL.
          SELECT SINGLE mtart
            FROM mara
            INTO lv_mtart
           WHERE matnr = <wa_vbap>-matnr.
        ELSE.
          SELECT SINGLE mtart spart
            FROM mara
            INTO (lv_mtart,<wa_vbap>-spart)
           WHERE matnr = <wa_vbap>-matnr.
        ENDIF.
      If material division is same as parameter division
        IF <wa_vbap>-spart = p_spart.
      If material is subsidiary-owned
       IF <wa_vbap>-spart in lr_spart.
        If customer is the same as that of parameter division
          IF <wa_vbap>-kunnr NE lr_kunnr OR <wa_vbap>-auart EQ 'ZUDO' OR <wa_vbap>-auart EQ 'ZUS3'.
          If item is a free good, tag order type as 'ZUPR' to treat
          the item the same way as 'ZUPR'
            IF <wa_vbap>-pstyv = 'TANN' OR
               <wa_vbap>-pstyv = 'ZKNF' OR
               <wa_vbap>-pstyv = 'ZKNN' OR
               <wa_vbap>-pstyv = 'ZFLO' OR
               <wa_vbap>-pstyv = 'ZKBF' OR
               <wa_vbap>-pstyv = 'ZKLN' OR
               <wa_vbap>-pstyv = 'ZREN'.
              lv_auart = <wa_vbap>-auart.
              IF lv_auart EQ 'ZUPR'.
                CLEAR <wa_vbap>-pstyv.
              ENDIF.
              <wa_vbap>-auart = 'ZUPR'.
              CLEAR: lv_mtart.
            ENDIF.
          Set Cost of Goods Sold Account
            <wa_vbap>-cogshkont = '0050000010'.
            CASE <wa_vbap>-auart.
              WHEN 'ZUPR'.
                CASE lv_mtart.
                  WHEN 'ZUL4'.
                    <wa_vbap>-del_ind = 'X'.
                    CONTINUE.
                  WHEN OTHERS.
                  Check if division is defined in mapping table
                    READ TABLE lt_ulsub INTO wa_ulsub
                         WITH KEY spart = <wa_vbap>-spart.
                    IF sy-subrc = 0.
                      <wa_vbap>-kostl = wa_ulsub-kostlp.
                      <wa_vbap>-bukrs = wa_ulsub-bukrsp.
                      <wa_vbap>-type = 'TP'.
                    Set Cost of Goods Sold Account
                      IF lv_auart = 'ZUPR'.
                        <wa_vbap>-cogshkont = '0050000006'.
                      ENDIF.
                    ELSE.
                      <wa_vbap>-del_ind = 'X'.
                      CONTINUE.
                    ENDIF.
                ENDCASE.
              WHEN 'ZUCI' OR 'ZUDO' OR 'ZURD' OR 'ZUS3'.
            Get cost center from header text
                PERFORM get_cost_center USING <wa_vbap>-vbeln
                                     CHANGING <wa_vbap>-kostl.
    *  Change by LGTE 11-02-2006
            Check if Medvale sales
                IF <wa_vbap>-auart EQ 'ZUCI' AND <wa_vbap>-kostl IS INITIAL.
                  <wa_vbap>-del_ind = 'X'.
                  CONTINUE.
            Check if UL Cost Center
                ELSEIF <wa_vbap>-kostl NE gv_ul_kostl.
               IF <wa_vbap>-kostl NE gv_ul_kostl.
    *  End change.
              Get material division and check if subsidiary product
                 SELECT SINGLE spart FROM mara INTO <wa_vbap>-spart
                 WHERE matnr = <wa_vbap>-matnr.
                  READ TABLE lt_ulsub INTO wa_ulsub
                       WITH KEY spart = <wa_vbap>-spart.
                  IF sy-subrc = 0.
                  Get requestor's company code from cost center data
                    SELECT SINGLE bukrs
                      FROM csks
                      INTO <wa_vbap>-bukrs
                     WHERE kokrs =  lc_kokrs
                       AND kostl =  <wa_vbap>-kostl
                       AND datbi GE sy-datum
                       AND datab LE sy-datum.
                    IF sy-subrc = 0.
                    For donations, only include if a subsidiary company is donating
                      IF <wa_vbap>-auart EQ 'ZUDO' OR <wa_vbap>-auart EQ 'ZUS3'.
                        IF NOT <wa_vbap>-kunnr IN lr_kunnrnt.
                          <wa_vbap>-del_ind = 'X'.
                          CONTINUE.
                        ENDIF.
                       CHECK <wa_vbap>-kunnr IN lr_kunnrnt.
                      ENDIF.
                    For ZUCI, if the company code of the costcenter is UL, do not include
                      IF <wa_vbap>-bukrs EQ gc_ul_bukrs.
                        <wa_vbap>-del_ind = 'X'.
                        CONTINUE.
                      ENDIF.
                      IF <wa_vbap>-bukrs = wa_ulsub-bukrsp.
                        <wa_vbap>-type = 'RV'.
                      ELSE.
                        <wa_vbap>-type = 'RV'.
                      ENDIF.
                    ELSE.
                    Check if customer defined in table ZFI_DONATIONS
                      SELECT SINGLE kunnr FROM zfi_donations INTO <wa_vbap>-kostl
                        WHERE kunnr = <wa_vbap>-kostl.
                      IF sy-subrc <> 0.
                        lv_error = 'X'.
                        CONCATENATE 'Cost center/Customer' <wa_vbap>-kostl
                                    'does not exist. Please check Sales Order'
                                    <wa_vbap>-vbeln
                                    INTO lt_disp-message SEPARATED BY space.
                        lt_disp-type = 'E'.
                        <wa_vbap>-del_ind = 'X'.
                        APPEND lt_disp.
                        CONTINUE.
                      ELSE.
                        <wa_vbap>-type = 'RV'.
                      ENDIF.
                    ENDIF.
                  ELSE.
                    <wa_vbap>-del_ind = 'X'.
                    CONTINUE.
                  ENDIF.
                ELSE.
                  <wa_vbap>-del_ind = 'X'.
                  CONTINUE.
                ENDIF.
              WHEN OTHERS.
                <wa_vbap>-del_ind = 'X'.
                CONTINUE.
            ENDCASE.
          ELSE.
            <wa_vbap>-del_ind = 'X'.
            CONTINUE.
          ENDIF.
        ELSE.
          <wa_vbap>-del_ind = 'X'.
          CONTINUE.
        ENDIF.
      Get company code description
        SELECT SINGLE butxt FROM t001 INTO <wa_vbap>-butxt
         WHERE bukrs = <wa_vbap>-bukrs.
        IF sy-subrc <> 0.
          SELECT SINGLE name1 FROM kna1 INTO <wa_vbap>-butxt
           WHERE kunnr = <wa_vbap>-kostl.
        ENDIF.
    Change by LGTE on 11-02-2006
    Get Transaction Type
        CASE <wa_vbap>-auart.
          WHEN 'ZUPR'. "UL Promo/Samples
            IF <wa_vbap>-pstyv = 'TANN' OR
               <wa_vbap>-pstyv = 'ZKNF' OR
               <wa_vbap>-pstyv = 'ZKNN' OR
               <wa_vbap>-pstyv = 'ZFLO' OR
               <wa_vbap>-pstyv = 'ZKBF' OR
               <wa_vbap>-pstyv = 'ZKLN' OR
               <wa_vbap>-pstyv = 'ZREN'.
              <wa_vbap>-ltext = 'Free Goods'.
            ELSE.
              <wa_vbap>-ltext = 'Product Samples'.
            ENDIF.
          WHEN 'ZUDO'. "Donations - R/3
            <wa_vbap>-ltext = 'Donations - R/3'.
          WHEN 'ZUCI'. "Donations - ZUCI
            <wa_vbap>-ltext = 'Donations - ZUCI'.
          WHEN 'ZURD' OR 'ZUS3'. "UL Returns - Donation
            <wa_vbap>-ltext = 'UL Returns - Donation'.
        ENDCASE.
    Get material description
        SELECT SINGLE maktx
          FROM makt
          INTO <wa_vbap>-maktx
         WHERE matnr = <wa_vbap>-matnr
           AND spras = sy-langu.
    Get division from material master
       SELECT SINGLE spart FROM mara INTO <wa_vbap>-spart
        WHERE matnr = <wa_vbap>-matnr.
    Get division description
        SELECT SINGLE vtext
          FROM tspat
          INTO <wa_vbap>-vtext
         WHERE spras = sy-langu
           AND spart = <wa_vbap>-spart.
    Get Valuation Class
        SELECT SINGLE bklas
          FROM mbew
          INTO lv_bklas
         WHERE matnr = <wa_vbap>-matnr.
    Determine G/L of FG Based on Valuation Class
        READ TABLE lt_val_cls INTO wa_val_cls WITH TABLE KEY bklas = lv_bklas.
        <wa_vbap>-fghkont = wa_val_cls-hkont.
    Determine Cost Center of Cogs Account
        READ TABLE lt_ulsub INTO wa_ulsub WITH TABLE KEY spart = <wa_vbap>-spart.
        <wa_vbap>-cogskostl = wa_ulsub-kostlp.

    Hi!
    First of all, don't use SELECT SINGLE inside of LOOP,
    instead  SELECT all relevated rows before LOOP in intertal tables (using FOR ALL ENTRIES) and then use
    READ TABLE WITH KEY BINARY SEARCH.
    it will match faster.
    for example:
    IF NOT lt_vbap[] IS INITIAL.
    SELECT vbeln
    FROM vbfa
    INTO lt_vbill
    FOR ALL ENTRIES IN lt_vbap
    WHERE vbelv = lt_vbap-vbeln.
    ENDIF.
    SORT lt_vbap BY vbeln.
    READ TABLE lt_vbill WITH KEY vbeln = <wa_vbap>-vbeln
    BINARY SEARCH.

  • Dbms_stats fails on larger patitioned tables.

    Hi,
    I need to run dbms_stats on partitioned table with partition as large as 300gb and it fails please help how would i work on a startegy to collect stats.
    Thanks,
    Kp

    "it fails" and "there no errors and just doesnt complete and have to stop" are not the same thing.
    Does it fail ?
    OR
    Does it take long to run (and you haven't waited for it to complete) ?
    With very large Partitioned Tables you need to be sure of the GRANULARITY, DEGREE, METHOD_OPT and CASCADE options of the Gather_Stats that you need to / want to run.
    I think so questions are enough the question is can you answerWe have no idea of the options you use, the type and number of partitons, whether all the partitions have changing data, how many indexes exist, whether indexes are Global or Local, how many PQ operators are available and in use etc.
    So , we cannot answer your question.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Problem to update very large volume of data for 2LIS_04* extr.

    Hi
    I have problem with jobs for 2LIS_04* extractors using Queued Delta.
    There are interface between R3 system and other production system and 3 or 4 times in the month very large volumen of data has been send to R3.
    Then job runs very long and not pull data to RSA7.
    How to resolve this problem.
    Our R3 system is PI_BASIS 2005_1_620.
    Thanks
    Adam

    U can check these SAP Notes..........it will help u........
    How can downtime be reduced for setup table update
    SAP Note Number: 753654
    Performance improvement for filling the setup tables
    SAP Note Number: 436393
    LBWE: Performance for setup of extract structures
    SAP Note Number: 437672

  • Updating an xmltype table

    hi,
    I have two xmltype tables(eg. testTableSB and testTableNSB), first one is schema-based(conforms to schemaA) and the other one is non-schema-based.
    So the default storage will be object-relational and CLOB respectively.
    I load the same xml document in both the tables. Each table has one row only(suppose).
    Later I use the update statement with updateXML() in RHS as following:
    update testTableSB x
    set value(x)=updatexml(value(x),'/Company/Person[2]/@Degree','PHD');
    update testTableNSB x
    set value(x)=updatexml(value(x),'/Company/Person[2]/@Degree','BA');
    Both updates work. From the documentation, I came to know that in the first table it only updates the node or attribute value whereas in the second update, the whole document is repalced because it is CLOB based.
    My confusion is in the second update since it seems updating (in this case) only the attribute value.
    Please suggest.
    One more question, how to check whether the storage option for the table is object-relational or CLOB. One option is to describe the table. In this way, it gives info for object-relational only not for CLOB. what is the other way to check it? Any data_dictionary table?
    SQL> create table testTableNSB of XMLType;
    Table created.
    SQL> describe testTableNSB;
    Name Null? Type
    TABLE of XMLTYPE
    Thanking in advance.

    Hi
    I as wrote I never tested this possibility... therefore I did the following test.
    A table contains the following XML data:
    SQL> select extract(value(o), '/optw/person')
    2 from optw1_or_ot o
    3 where existsnode(value(o), '/optw/person[@id=5]') = 1;
    EXTRACT(VALUE(O),'/OPTW/PERSON')
    <person id="5">
    <lastname>String</lastname>
    <firstname>String</firstname>
    <sex>F</sex>
    </person>
    If I access the underlying structure, the query looks like this (notice that birthday is NULL):
    SQL> select x.id, x.lastname, x.firstname, x.birthday, x.sex
    2 from optw1_or_ot o, table(o.xmldata.persons) x
    3 where x.id = 5;
    ID LASTNAME FIRSTNAME BIRTHDAY SEX
    5 String String F
    If I update the data, it seams to work...
    SQL> update table(select o.xmldata.persons
    2 from optw1_or_ot o, table(o.xmldata.persons) x
    3 where x.id = 5) t
    4 set t.birthday = sysdate;
    1 row updated.
    SQL> select x.id, x.lastname, x.firstname, x.birthday, x.sex
    2 from optw1_or_ot o, table(o.xmldata.persons) x
    3 where x.id = 5;
    ID LASTNAME FIRSTNAME BIRTHDAY SEX
    5 String String 06-FEB-04 F
    But if I select the XML data again, the data isn't available...
    SQL> select extract(value(o), '/optw/person')
    2 from optw1_or_ot o
    3 where existsnode(value(o), '/optw/person[@id=5]') = 1;
    EXTRACT(VALUE(O),'/OPTW/PERSON')
    <person id="5">
    <lastname>String</lastname>
    <firstname>String</firstname>
    <sex>F</sex>
    </person>
    It seams that Oracle also stores "control" information in another columns.
    Therefore the only way to add such an element is through the updatexml() function.
    Chris

  • XMLDB resource_view & xmltype table join problem

    Hi,
    When I join resource_view and an xmltype table using ref() I got no rows returned. Am I doing something wrong?
    XMLRef resource_view proplem
    Thanks in advance
    Erturk

    what is the output for this one -
    select ref(p), extractValue(r.res, '/Resource/XMLRef')
    from resource_view r, purchaseorder p;
    also please share the ddl and sample data for the case so anyone interested may work on it.
    Best regards.

  • Insert XML file into Relational database model without using XMLTYPE tables

    Dear all,
    How can I store a known complex XML file into an existing relational database WITHOUT using xmltypes in the database ?
    I read the article on DBMS_XMLSTORE. DBMS_XMLSTORE indeed partially bridges the gap between XML and RDBMS to a certain extent, namely for simply structured XML (canonical structure) and simple tables.
    However, when the XML structure will become arbitrary and rapidly evolving, surely there must be a way to map XML to a relational model more flexibly.
    We work in a java/Oracle10 environment that receives very large XML documents from an independent data management source. These files comply with an XML schema. That is all we know. Still, all these data must be inserted/updated daily in an existing relational model. Quite an assignment isn't it ?
    The database does and will not contain XMLTYPES, only plain RDBMS tables.
    Are you aware of a framework/product or tool to do what DBMS_XMLSTORE does but with any format of XML file ? If not, I am doomed.
    Constraints : Input via XML files defined by third party
    Storage : relational database model with hundreds of tables and thousands of existing queries that can not be touched. The model must not be altered.
    Target : get this XML into the database on a daily basis via an automated process.
    Cheers.
    Luc.

    Luc,
    your Doomed !
    If you would try something like DBMS_XMLSTORE, you probably would be into serious performance problems in your case, very fast, and it would be very difficult to manage.
    If you would use a little bit of XMLType stuff, you would be able to shred the data into the relational model very fast and controlable. Take it from me, I am one of those old geezers like Mr. Tom Kyte way beyond 40 years (still joking). No seriously. I started out as a classical PL/SQL, Forms Guy that switched after two years to become a "DBA 1.0" and Mr Codd and Mr Date were for years my biggest hero's. I have the utmost respect for Mr. Tom Kyte for all his efforts for bringing the concepts manual into the development world. Just to name some off the names that influenced me. But you will have to work with UNSTRUCTURED data (as Mr Date would call it). 80% of the data out there exists off it. Stuff like XMLTABLE and XML VIEWs bridge the gap between that unstructured world and the relational world. It is very doable to drag and drop an XML file into the XMLDB database into a XMLtype table and or for instance via FTP. From that point on it is in the database. From there you could move into relational tables via XMLTABLE methods or XML Views.
    You could see the described method as a filtering option so XML can be transformed into relational data. If you don't want any XML in your current database, then create an small Oracle database with XML DB installed (if doable 11.1.0.7 regarding the best performance --> all the new fast optimizer stuff etc). Use that database as a staging area that does all the XML shredding for you into relational components and ship the end result via database links and or materialized views or other probably known methodes into your relational database that isn't allowed to have XMLType.
    This way you would keep your realtional Oracle database clean and have the Oracle XML DB staging database do all the filtering and shredding into relational components.
    Throwing the XML DB option out off the window beforehand would be like replacing your Mercedes with a bicycle. With both you will be able to travel the distance from Paris to Rome, but it will take you a hell of lot longer.
    :-)

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

  • Exporting xmltype table data into xml/txt file

    I want to export data stored in oracle as xmltype table into xml format file.
    I want to use alternatives to the method shown below as my xml file is large.
    set long 10000000
    spool c:\\StudentXMLJan08.xml
    SELECT
    XMLElement("Student",
    XMLForest(s.studentid "studentid",
    s.firstname "firstname",
    s.lastname "surname"),
    XMLElement("enrollments",
    (SELECT XMLAGG(
    XMLForest(sc.coursecode "courseid"))
    FROM studentcourse sc
    WHERE sc.studentid = s.studentid
    and sc.is_approved='Y'
    and sc.takenyear='2008'
    and sc.takenterm='1')))
    FROM student s
    where s.statuscode in (select studentstatuscode from studentstatus where studentstatusactive=1)
    order by s.studentid;
    spool off
    please help, thank you

    How's this one for size
    SQL> create or replace view DEPARTMENT_XML of xmltype
      2  with object id
      3  (
      4    'DEPARTMENT'
      5  )
      6  as
      7  select xmlElement
      8         (
      9           "Departments",
    10           (
    11             select xmlAgg
    12                    (
    13                      xmlElement
    14                      (
    15                      "Department",
    16                      xmlAttributes( d.DEPARTMENT_ID as "DepartmentId"),
    17                      xmlElement("Name", d.DEPARTMENT_NAME),
    18                      xmlElement
    19                      (
    20                        "Location",
    21                        xmlForest
    22                        (
    23                           STREET_ADDRESS as "Address", CITY as "City", STATE_PROVINCE as "State",
    24                           POSTAL_CODE as "Zip",COUNTRY_NAME as "Country"
    25                        )
    26                      ),
    27                      xmlElement
    28                      (
    29                        "EmployeeList",
    30                        (
    31                          select xmlAgg
    32                                 (
    33                                   xmlElement
    34                                   (
    35                                     "Employee",
    36                                     xmlAttributes ( e.EMPLOYEE_ID as "employeeNumber" ),
    37                                     xmlForest
    38                                     (
    39                                       e.FIRST_NAME as "FirstName", e.LAST_NAME as "LastName", e.EMAIL as "EmailAddre
    ss",
    40                                       e.PHONE_NUMBER as "Telephone", e.HIRE_DATE as "StartDate", j.JOB_TITLE as "Job
    Title",
    41                                       e.SALARY as "Salary", m.FIRST_NAME || ' ' || m.LAST_NAME as "Manager"
    42                                     ),
    43                                     xmlElement ( "Commission", e.COMMISSION_PCT )
    44                                   )
    45                                 )
    46                            from HR.EMPLOYEES e, HR.EMPLOYEES m, HR.JOBS j
    47                           where e.DEPARTMENT_ID = d.DEPARTMENT_ID
    48                             and j.JOB_ID = e.JOB_ID
    49                             and m.EMPLOYEE_ID = e.MANAGER_ID
    50                        )
    51                      )
    52                    )
    53                  )
    54             from HR.DEPARTMENTS d, HR.COUNTRIES c, HR.LOCATIONS l
    55            where d.LOCATION_ID = l.LOCATION_ID
    56              and l.COUNTRY_ID  = c.COUNTRY_ID
    57           )
    58         )
    59    from dual
    60  /
    View created.
    SQL> create or replace trigger DEPARTMENT_DML
      2  instead of INSERT or UPDATE or DELETE
      3  on DEPARTMENT_XML
      4  begin
      5    null;
      6  end;
      7  /
    Trigger created.
    SQL> declare
      2    cursor getDepartments is
      3      select ref(d) XMLREF
      4        from DEPARTMENT_XML d;
      5    res boolean;
      6    targetFolder varchar2(1024) :=  '/public/Departments';
      7  begin
      8    if dbms_xdb.existsResource(targetFolder) then
      9       dbms_xdb.deleteResource(targetFolder,dbms_xdb.DELETE_RECURSIVE_FORCE);
    10    end if;
    11    res := dbms_xdb.createFolder(targetFolder);
    12    for dept in getDepartments loop
    13      res := DBMS_XDB.createResource(targetFolder || '/Departments.xml', dept.XMLREF);
    14    end loop;
    15  end;
    16  /
    PL/SQL procedure successfully completed.
    SQL> select path
      2    from path_view
      3   where equals_path(RES,'/public/Departments/Departments.xml') = 1
      4  /
    PATH
    /public/Departments/Departments.xml
    SQL> select xdburitype('/public/Departments/Departments.xml').getXML()
      2    from dual
      3  /
    XDBURITYPE('/PUBLIC/DEPARTMENTS/DEPARTMENTS.XML').GETXML()
    <Departments>
      <Department DepartmentId="60">
        <Name>IT</Name>
        <Location
    SQL> quit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    C:\Temp>ftp localhost
    Connected to mdrake-lap.
    220- mdrake-lap
    Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution.
    220 mdrake-lap FTP Server (Oracle XML DB/Oracle Database) ready.
    User (mdrake-lap:(none)): SCOTT
    331 pass required for SCOTT
    Password:
    230 SCOTT logged in
    ftp> cd /public/Departments
    250 CWD Command successful
    ftp> ls -l
    200 EPRT Command successful
    150 ASCII Data Connection
    -rw-r--r--   1 SCOTT    oracle         0 NOV 10 20:18 Departments.xml
    226 ASCII Transfer Complete
    ftp: 71 bytes received in 0.01Seconds 7.10Kbytes/sec.
    ftp> get Departments.xml -
    200 EPRT Command successful
    150 ASCII Data Connection
    <Departments><Department DepartmentId="60"><Name>IT</Name><Location><Address>2014 Jabberwocky Rd</Address><City>Southlak
    e</City><State>Texas</State><Zip>26192</Zip><Country>United States of America</Country></Location><EmployeeList><Employe
    e employeeNumber="103"><FirstName>Alexander</FirstName><LastName>Hunold</LastName><EmailAddress>AHUNOLD</EmailAddress><T
    elephone>590.423.4567</Telephone><StartDate>2006-01-03</StartDate><JobTitle>Programmer</JobTitle><Salary>9000</Salary><M
    anager>Lex De Haan</Manager><Commission></Commission></Employee><Employee employeeNumber="105"><FirstName>David</FirstNa
    me><LastName>Austin</LastName><EmailAddress>DAUSTIN</EmailAddress><Telephone>590.423.4569</Telephone><StartDate>2005-06-
    25</StartDate><JobTitle>Programmer</JobTitle><Salary>4800</Salary><Manager>Alexander Hunold</Manager><Commission></Commi
    ssion></Employee><Employee employeeNumber="106"><FirstName>Valli</FirstName><LastName>Pataballa</LastName><EmailAddress>
    VPATABAL</EmailAddress><Telephone>590.423.4560</Telephone><StartDate>2006-02-05</StartDate><JobTitle>Programmer</JobTitl
    e><Salary>4800</Salary><Manager>Alexander Hunold</Manager><Commission></Commission></Employee><Employee employeeNumber="
    107"><FirstName>Diana</FirstName><LastName>Lorentz</LastName><EmailAddress>DLORENTZ</EmailAddress><Telephone>590.423.556
    7</Telephone><StartDate>2007-02-07</StartDate><JobTitle>Programmer</JobTitle><Salary>4200</Salary><Manager>Alexander Hun
    old</Manager><Commission></Commission></Employee><Employee employeeNumber="104"><FirstName>Bruce</FirstName><LastName>Er
    nst</LastName><EmailAddress>BERNST</EmailAddress><Telephone>590.423.4568</Telephone><StartDate>2007-05-21</StartDate><Jo
    bTitle>Programmer</JobTitle><Salary>6000</Salary><Manager>Alexander Hunold</Manager><Commission></Commission></Employee>
    </EmployeeList></Department><Department DepartmentId="50"><Name>Shipping</Name><Location><Address>2011 Interiors Blvd</A
    ddress><City>South San Francisco</City><State>California</State><Zip>99236</Zip><Country>United States of America</Count
    ry></Location><EmployeeList><Employee employeeNumber="120"><FirstName>Matthew</FirstName><LastName>Weiss</LastName><Emai
    lAddress>MWEISS</EmailAddress><Telephone>650.123.1234</Telephone><StartDate>2004-07-18</StartDate><JobTitle>Stock Manage
    r</JobTitle><Salary>8000</Salary><Manager>Steven King</Manager><Commission></Commission></Employee><Employee employeeNum
    ber="122"><FirstName>Payam</FirstName><LastName>Kaufling</LastName><EmailAddress>PKAUFLIN</EmailAddress><Telephone>650.1
    23.3234</Telephone><StartDate>2003-05-01</StartDate><JobTitle>Stock Manager</JobTitle><Salary>7900</Salary><Manager>Stev
    en King</Manager><Commission></Commission></Employee><Employee employeeNumber="121"><FirstName>Adam</FirstName><LastName
    Fripp</LastName><EmailAddress>AFRIPP</EmailAddress><Telephone>650.123.2234</Telephone><StartDate>2005-04-10</StartDate><JobTitle>Stock Manager</JobTitle><Salary>8200</Salary><Manager>Steven King</Manager><Commission></Commission></Employee
    <Employee employeeNumber="124"><FirstName>Kevin</FirstName><LastName>Mourgos</LastName><EmailAddress>KMOURGOS</EmailAddress><Telephone>650.123.5234</Telephone><StartDate>2007-11-16</StartDate><JobTitle>Stock Manager</JobTitle><Salary>5800<
    /Salary><Manager>Steven King</Manager><Commission></Commission></Employee><Employee employeeNumber="123"><FirstName>Shan
    ta</FirstName><LastName>Vollman</LastName><EmailAddress>SVOLLMAN</EmailAddress><Telephone>650.123.4234</Telephone><Start
    Date>2005-10-10</StartDate><JobTitle>Stock Manager</JobTitle><Salary>6500</Salary><Manager>Steven King</Manager><Commiss
    ion></Commission></Employee><Employee employeeNumber="128"><FirstName>Steven</FirstName><LastName>Markle</LastName><Emai
    lAddress>SMARKLE</EmailAddress><Telephone>650.124.1434</Telephone><StartDate>2008-03-08</StartDate><JobTitle>Stock Clerk
    </JobTitle><Salary>2200</Salary><Manager>Matthew Weiss</Manager><Commission></Commission></Employee><Employee employeeNu
    mber="127"><FirstName>James</FirstName><LastName>Landry</LastName><EmailAddress>JLANDRY</EmailAddress><Telephone>650.124
    .1334</Telephone><StartDate>2007-01-14</StartDate><JobTitle>Stock Clerk</JobTitle><Salary>2400</Salary><Manager>Matthew
    Weiss</Manager><Commission></Commission></Employee><Employee employeeNumber="126"><FirstName>Irene</FirstName><LastName>
    Mikkilineni</LastName><EmailAddress>IMIKKILI</EmailAddress><Telephone>650.124.1224</Telephone>
    <StartDate>2002-06-07</St
    artDate><JobTitle>Public Relations Representative</JobTitle><Salary>10000</Salary><Manager>Neena Kochhar</Manager><Commi
    ssion></Commission></Employee></EmployeeList></Department></Departments>226 ASCII Transfer Complete
    ftp: 40392 bytes received in 0.08Seconds 480.86Kbytes/sec.
    ftp>

  • Keeping two very large datastores in sync

    I'm looking at options for keeping a very large (potentially 400GB) TimesTen (11.2.2.5) datastore in sync between a Production server and a [warm] Standby.
    Replication has been discounted because it doesn't support compressed tables, nor the types of table our closed-code application is creating (without non-null PKs)
    I've done some testing with smaller datastores to get indicative numbers, and a 7.4GB datastore (according to dssize) resulted in a 35GB backup set (using ttBackup -type fileIncrOrFull). Is that large increase in volume expected, and would it extrapolate up for a 400GB data store (2TB backup set??)?
    I've seen that there are Incremental backups, but to maintain our standby as warm, we'll be restoring these backups and from what I'd read & tested only a ttDestroy/ttRestore is possible, i.e. complete restore of the complete DSN each time, which is time consuming. Am I missing a smarter way of doing this?
    Other than building our application to keep the two datastores in sync, are there any other tricks we can use to efficiently keep the two datastores in sync?
    Random last question - I see "datastore" and "database" (and to an extent, "DSN") used apparently interchangeably - are they the same thing in TimesTen?
    Update: the 35GB compresses down with 7za to just over 2.2GB, but takes 5.5 hours to do so. If I take a standalone fileFull backup it is just 7.4GB on disk, and completes faster too.
    thanks,
    rmoff.
    Message was edited by: rmoff - add additional detail

    This must be an Exalytics system, right? I ask this because compressed tables are not licensed for use outside of an Exalytics system...
    As you note, currently replication is not possible in an Exalytics environment, but that is likely to change in the future and then it will definitely be the preferred mechanism for this. There is not really any other viable way to do this other than through the application.
    With regard to your specific questions:
    1.   A backup consists primarily of the most recent checkpoint file plus all log files/records that are newer than that file. So, to minimise the size of a full backup ensure
         that a checkpoint occurs (for example 'call ttCkpt' from a ttIsql session) immediately prior to starting the backup.
    2.   No, only complete restore is possible from an incremental backup set. Also note that due to the large amount of rollforward needed, restoring a large incremental backup set may take quite a long time. Backup and restore are not really intended for this purpose.
    3.   If you cannot use replication then some kind of application level sync is your only option.
    4.   Datastore and database mean the same thing - a physical TimesTen database. We prefer the term database nowadays; datastore is a legacy term. A DSN is a different thing (Data Source Name) and should not be used interchangeably with datastore/database. A DSN is a logical entity that defines the attributes for a database and how to connect to it. It is not the same as a database.
    Chris

  • How to create XMLTYPE View from the XMLType table

    Hi:
    I have a large XML file and inserted to the XMLTYPE table
    For the XQUERY purpose I would like to create XMLView of the table.
    The examples I got from Oracle to create XML view are for small files.
    Can some one help me how to create XMLType VIEW for large XML Files ( 20,000 lines )?
    Ali_2

    Have a look at the examples given on XMLType Views (based on relational tables) or standard views (based on XMLType storage) in the FAQ url located on the main page of this forum site regarding XMLDB.

  • Update multiply nodes on XMLType field

    Hello to all.
    I have this table
    +"DOCUMENT"+
    +(+
    +"ID" NUMBER NOT NULL ENABLE,+
    +"ID_ARCHIVE" NUMBER NOT NULL ENABLE,+
    +"USERNAME" VARCHAR2(20 BYTE),+
    +"CREATION_DATE" DATE,+
    +"LAST_UPDATE" DATE,+
    +"LAST_USERNAME" VARCHAR2(20 BYTE),+
    +"VISIBLE" NUMBER,+
    +"STATE" VARCHAR2(20 BYTE),+
    +"XML" "SYS"."XMLTYPE" ,)+
    This is an example of XML value:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <fields>
    <field fieldId="text_141536485" iterable="true" type="text" specification="simple" name="tiolo" value="1" required="false" status="ok" searchable="true" isField="true" isIterate="false"/><field fieldId="comp_1235813718" iterable="true" type="composite" specification="composite" status="ok" searchable="true" isField="true" isIterate="false">
    <fields>
    <field fieldId="text_-1661573009" iterable="true" type="text" specification="simple" name="New" value="1" required="false" status="ok" searchable="true" isField="true" isIterate="false"/>
    <field fieldId="text_-1661573009" iterable="true" type="text" specification="simple" name="New" value="2" required="false" status="ok" searchable="true" isField="true" isIterate="true"/>
    </fields>
    </field>
    <field fieldId="comp_1235813718" iterable="false" isIterate="true" type="default" specification="default" status="ok" isField="true">
    <fields/>
    </field>
    </fields>
    </root>
    Id like to update the attribute name of all fields whit fieldId="text_-1661573009" to, ie, 'Counter'
    I try this query:
    SELECT d.XML.extract('//field')  from DOCUMENT d
    *where d.XML.existsNode('//field[@fieldId="text_-1661573009"]')=1;*
    it returns all fields with fieldId="text_-1661573009"
    The update:
    update document d set .OBJECT_VALUE = d.XML.updateXML(OBJECT_VALUE,'//field/@fieldId','Counter')
    *where d.XML.existsNode(OBJECT_VALUE,'//field[@fieldId="text_-1661573009"]')=1;*
    I receive this error:
    Errore SQL: ORA-00904: "OBJECT_VALUE": invalid identifier
    *00904. 00000 - "%s: invalid identifier"*
    Somebody could help me to find the error?
    Thank you very much!
    Cristian

    Hi,
    I try this query:
    SELECT d.XML.extract('//field')  from DOCUMENT d
    *where d.XML.existsNode('//field[@fieldId="text_-1661573009"]')=1;*
    it returns all fields with fieldId="text_-1661573009"Actually, it returns all fields of a document where exists at least one field with fieldId "text_-1661573009".
    That will make a difference with updateXML, because it won't update the nodes you're expecting.
    I receive this error:
    Errore SQL: ORA-00904: "OBJECT_VALUE": invalid identifier
    00904. 00000 - "%s: invalid identifier"OBJECT_VALUE is only used to reference the column of an Object Type table, such as an XMLType table.
    Here, you're dealing with a regular table, so use the proper column name, ie "XML".
    Is this what you want to do :
    UPDATE document d
    SET d.xml = updateXML( d.xml,
                           '//field[@fieldId="text_-1661573009"]/@name',
                           'Counter' )
    WHERE d.xml.existsNode('//field[@fieldId="text_-1661573009"]') = 1
    ;?

  • XSLT on very large documents w/XSU

    Hi:
    I need to load some very large documents, and I am looking at the example in Ch. 14 (14-4?) of the Muench book. It looks fine, but my question is that if, for instance, the element names don't match the table column names, and I need to use XSLT to change them, can I "stream" this? I am afraid that since XSLT wants to work on a "tree", it will want me to tranform the 6 gig (e.g.) file before passing it to the SAX parser. Is this correct? Can I make "mini" trees inside the multitableInsertHandler and work off of those one at a time? Can I do something like "XMLSave.applyStylesheet" (whatever it is) on a doc. from XMLDocumentSplitter? Complex question(s) I know. I think I am close, but missing the obvious.
    Thanks.
    Mike
    null

    Thanks for the clarification. I am planning on having one "rowset" element,and many "row" elements, each of which would have a "table" and "operation" attribute, because I am trying to mirror another database via its log file. Each row will be an insert/update/delete for one of several tables. Do you see a problem with this approach (i.e., doing away with most of the "rowset" elements)? I don't plan on batching at this point.
    On batching: If I did batch, and if the transaction fails, and I get a vector back where everything is set to (-1) or whatever it does, how do I know which records in the transaction actually succeeded?
    Thanks again,
    Mike
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Yes. The Multitable insert handler transforms one "subdocument" at a time using XSLT into a multitable-insert document. The result isn't processed directly by XSU, but is processed by some code in the example that iterates the resulting <ROWSET table="xxx"> tags and "choreographs" the use of an OracleXMLSave for each target table.
    Steve Muench
    Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
    Author, Building Oracle XML Applications
    <HR></BLOCKQUOTE>
    null

  • I cannot see XMLType table in sql*plus

    Hi,
    Although I have wokred extensively with Oracle, I am new to Oracle XMLdb. My problem is I cannot see the XMLType tables created under my schema. I can see the tables when I do a select from user_xml_tables. But if I do a 'desc' or 'select from', I get ORA-04043 or ORA-00942. I can desc an XMLType table owned by xdb. I am using Oralce 10g. Please provide a solution asap as a customer is waiting on this.
    Thanks,
    Jayati Ray

    Raghu !!
    GREAT!!!
    It was a BUG in Oracle sql developer, I installed the new version v3.0, It WORKS like a CHARM.
    Thanks a million for your help!!!
    Cheers
    Tony

Maybe you are looking for

  • Have an HP Officejet Pro 8500 Wireless. Trying to print to it from my iPad2. Having some problems.

    I Have an HP Officejet Pro 8500 Wireless. Trying to print to it from my iPad2. Having some problems. Trying to print docs or files from the iPad usuall gets me a page that looks scrunched up to one side. Is there a good printer app (preferably free

  • What are patterns in BPM

    hi experts What are patterns in BPM

  • Short url options for iweb '08 & godaddy HEEEEEEEEEEEEEELP!!!!!

    I have a new website up. I used iweb 08 and Godaddy. I just want the name only. I want this to show up ---->Example www.sitename.com and the then according pages to follow. Example www.sitename.com/media, www.sitename.com/store, www.sitename.com/shir

  • P.o date

    R/All i want to confighure a check between MKPF_ BUDAT with reference to EKKO_BEDAT it will check, and does not allow for MIGO if Posting date is greater than MIGO posting Date right now it is allowing me post MIGO if P.O date is greater than posting

  • My iMessages aren't sending from my phone

    My IMessages aren't sending from my phone number and when I go to send and receive it won't let me select my phone number only my email. I've turned iMessage on and off. I've signed in and out of appleid. I've restarted my phone.  I've made sure that