Issue in updating the Huge XML by using updatexml function

Hi All,
Database Credentails:
Oracle 9i R2.
I have a huge xml like this,
<Root>
<abc></abc>
<abc></abc>
<abc></abc>
</Root>
The <abc></abc> will be more than 10000 under the <Root> tag.
I have tried to update this xml by using the following script,
for i in 1 .. 10000
loop
SELECT UPDATEXML(v_xml,'/Root/abc['|| i ||']','<abc>'|| i || '<abc>')
INTO v_xml;
dbms_output.put_line(i); -- Just to check how many values were updated
end loop;
While executing the above sample code, i am getting the error called
INVALID XPATH EXPRESSION,
some times it is executing to some number after that i am getting the above error. when i try execute the same code again i will get error for different i value.
Could you please help me out to fix this bug/mistake for me. Please provide me some sample code for this.
Thanks in Advance,
Vinoth Kumar S.

You don't need any loop for this. simple UPDATEXML statement should do.
sql> WITH myxmltab AS
  2  (SELECT XMLTYPE('<Root>
  3  <abc>4</abc>
  4  <abc>5</abc>
  5  <abc> </abc>
  6  <abc> </abc>
  7  <abc> </abc>
  8  <abc></abc>
  9  <abc></abc>
10  <abc></abc>
11  <abc></abc>
12  <abc></abc>
13  </Root>') xmlcol FROM dual)
14  select UPDATEXML(t.column_value,'/abc',xmltype('<abc>' || rownum || '</abc>')) from myxmltab,
15  table(xmlsequence(extract(xmlcol,'/Root/abc'))) t;
UPDATEXML(T.COLUMN_VALUE,'/ABC',XMLTYPE('<ABC>'||ROWNUM||'</ABC>'))
<abc>1</abc>
<abc>2</abc>
<abc>3</abc>
<abc>4</abc>
<abc>5</abc>
<abc>6</abc>
<abc>7</abc>
<abc>8</abc>
<abc>9</abc>
<abc>10</abc>
10 rows selected.
Elapsed: 00:00:00.04

Similar Messages

  • Issue in updating the Huge XML

    Hi All,
    Database Credentails:
    Oracle 9i R2.
    I have a huge xml like this,
    <Root>
    <abc></abc>
    <abc></abc>
    <abc></abc>
    </Root>
    The <abc></abc> will be more than 10000 under the <Root> tag.
    I have tried to update this xml by using the following script,
    for i in 1 .. 10000
    loop
    SELECT UPDATEXML(v_xml,'/Root/abc['|| i ||']','<abc>'|| i || '<abc>')
    INTO v_xml;
    dbms_output.put_line(i); -- Just to check how many values were updated
    end loop;
    While executing the above sample code, i am getting the error called
    INVALID XPATH EXPRESSION,
    some times it is executing to some number after that i am getting the above error. when i try execute the same code again i will get error for different i value.
    Could you please help me out to fix this bug/mistake for me. Please provide me some sample code for this.
    Thanks in Advance,
    Vinoth Kumar S.

    You don't need any loop for this. simple UPDATEXML statement should do.
    sql> WITH myxmltab AS
      2  (SELECT XMLTYPE('<Root>
      3  <abc>4</abc>
      4  <abc>5</abc>
      5  <abc> </abc>
      6  <abc> </abc>
      7  <abc> </abc>
      8  <abc></abc>
      9  <abc></abc>
    10  <abc></abc>
    11  <abc></abc>
    12  <abc></abc>
    13  </Root>') xmlcol FROM dual)
    14  select UPDATEXML(t.column_value,'/abc',xmltype('<abc>' || rownum || '</abc>')) from myxmltab,
    15  table(xmlsequence(extract(xmlcol,'/Root/abc'))) t;
    UPDATEXML(T.COLUMN_VALUE,'/ABC',XMLTYPE('<ABC>'||ROWNUM||'</ABC>'))
    <abc>1</abc>
    <abc>2</abc>
    <abc>3</abc>
    <abc>4</abc>
    <abc>5</abc>
    <abc>6</abc>
    <abc>7</abc>
    <abc>8</abc>
    <abc>9</abc>
    <abc>10</abc>
    10 rows selected.
    Elapsed: 00:00:00.04

  • Update the custom table by using Custom Function module.

    Hi Experts,
            My requirement is ,
    1) To create the Custom Z table with fields
               vbak-vbeln
               likp-vbeln
               vbuk-vbeln
      After creating this Z table.
    2) I have to create one custom function module.
        Based on this function module i have to update that Z table.
    3) Before these steps i have to write down an ALV report based on the tables vbak and vbeln, in that table i have to print vbak-vbeln. and also in report i generated check box and one custom button in application toolbar. after the report will displayed , when ever i click the button in application tollbar , this function module will executed and the table will be updated.
        But I developed the ALV report with custom button and check box successfully.
      My doubt is how to write the function module and based on that function module how to update the table.
          Please suggest me on this requirement.
        Thanks in Advance.
    Thanks and Regards
    Srihari.

    HI ,
         Can any one help me out on my above requiremnet..
    Thanks and Regards
    Srihari.

  • [svn] 3037: Update flex-config. xml files used by the team and qa webapps to use the {targetPlayerMajorVersion} token instead of a hardcoded player version in the library-path and external-library-path .

    Revision: 3037
    Author: [email protected]
    Date: 2008-08-29 06:54:15 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Update flex-config.xml files used by the team and qa webapps to use the {targetPlayerMajorVersion} token instead of a hardcoded player version in the library-path and external-library-path. This will allow the correct playerglobal.swc to be located when the target player version is set in the flex-config.xml or passed to mxmlc or compc.
    Modified Paths:
    blazeds/trunk/apps/team/WEB-INF/flex/flex-config.xml
    blazeds/trunk/qa/resources/config/flex-config.xml

    Unfortunately I don't have the
    "org.eclipse.swt.win32.win32.x86_3.1.2.jar" file. On my computer
    the folder is not set up the same way (C:\Program Files\Adobe\Flex
    Builder 2\plugins) instead it is set up as (C:\Program
    Files\Adobe\Flex Builder 2\metadata\plugins) but I've looked in
    everything and that file just isn't in there. I've re downloaded it
    twice. Still not there. Is there anything else i can do.

  • Updating the whole xml file in  XMLType column

    Hi ,
    I am facing the problem in updating the XMLTYPE column.
    I need to update the whole xml file
    This is my table
    SQL> desc EMPJAL_TABLE;
    Name Null? Type
    EMPLOYEEID NOT NULL VARCHAR2(140)
    EMPCOM VARCHAR2(100)
    EMPJAL SYS.XMLTYPE(XMLSchema "www.EMPSIM.com" Element "EMPJAL") STORAGE
    Object-relational TYPE "EMPJAL_T"
    I am able to form the CLOB object and trying to use this sql command
    UPDATE EMPJAL_TABLE SET EMPJAL = XMLType( ? ) ) WHERE EMPLOYEEID ='emp1234';
    Here I want to update the whole xmlfile in XMLTYPE column.
    Error is - ORA-00933: SQL command not properly ended
    Please advise
    Thanks
    Govinds

    Hi Mark,
    I apologise for this mistake. I am really putting lot of efforts and also worked/working in advance topics of XML DB.
    Yes I am extensively using Oracle 10g r2 and suggesting others to use this
    This time I had put more effort before posting ,I had a series of queries to resolve most of then were working , this was the one giving problem inside my java code
    I am sorry for this .
    Any how I made another query which works better.
    Thanks
    Govinda

  • How do you update the Bios safely when using onboard RAID mirror? Z87-G45

    How do you update the Bios safely when using onboard RAID with Z87-G45?   I'm using a simple two drive, RAID 1 mirror setup.
    I'm currently at bios 1.4, and want to move up.  However, last time I upgraded the BIOS, the machine rebooted with improper settings for the RAID (they get hosed during BIOS flash) and Windows decided to auto-repair the only boot drive it could see, one half of the mirror, because it couldn't see the RAID array correctly and *POOF*  bare-metal reinstall required.   
    My PC will not let me press the DEL key on bootup to access the bios, even with MSI Fast Boot not installed.  It just ignores the DEL key and tries to load windows which, if that happens, will flame-out my RAID array after a bios flash if I can't catch it to enable the RAID first before windows loads.
    I do not want to rebuild my PC again simply because I do a BIOS update.

    FYI: BIOS 1.4 & 1.8 are using the same RAID version: 12.7.0.1936
    based on this RAID surprise should not hapends.
    But as pandaz says if you have no issues, leave bios update alone.
    there are still risks something to messed up,
    best do a backup of your data just in case if you want to try latest version

  • Where is it at?.....its July 20, and i dont see nada??? what in the ****-o bobby??? umm my iphone os updates the big ones anyway used to come out at midnight

    where is it at?.....its July 20, and i dont see nada??? what in the **** bobby??? umm my iphone os updates the big ones anyway used to come out at midnight.......yea?

    Then, you need to sharpen your search skills. A google search for Lion ships today brings up many hits, with this one mentioning a time: http://isource.com/2011/07/19/confirmed-os-x-lion-ships-tomorrow/

  • Where is it at?.....its July 20, and i dont see nada??? what in the **** bobby??? umm my iphone os updates the big ones anyway used to come out at midnight

    where is it at?.....its July 20, and i dont see nada??? what in the **** bobby??? umm my iphone os updates the big ones anyway used to come out at midnight

    FWIW, this is a user forum. We are all users like you. No Apple employees here and Apple doesn't follow these forums. You aren't speaking to Apple here.

  • Issue while posting the invoice in background using the WF-BATCH user

    Hi Friends,
      I am facing an issue while posting the invoice in background using the WF-BATCH user. I am using a invoice approval workflow where in when the approver approvers the invoice the invoice document get posted using a background method, which uses BO FIPP and Method POST and i am returning the Message Text to my workflow container from this method. When i see the log an exception is rasied from this method with an error  message "V004: You are not authorized to change this document", but WF-BATCH is having SAP_ALL and SAP_NEW authorizations. If i try to post the invoice using the method from my user id it is getting posted. What could be the issue. Please advice.

    Hi Sapient,
    The Parameter, Roles would be different for the LOGIN USER and WF-BATCH.. So ask your administrator
    to set the Roles & Parameters similar to that of LOGIN USER to WF-BATCH.
    For further refrence check in SU01 giving the LOGIN USER and then check with WF-BATCH... you would
    find the difference...
    Hope this would help you..
    Good luck
    Narin

  • Issue While executing the Query for Pagination using ROWNUM with like

    Issue While executing the Query for Pagination using ROWNUM with like.
    Database is Oracle11G.
    Oracle Database Table contains 8-9 lakh records
    1) SQL equal (=)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920'
    Execution Time:- 0.00869245 seconds
    Returns 2 resultsets
    2) SQL like (one %)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920%'
    Execution Time:- 0.01094301 seconds
    Returns 2 resultsets
    3) SQL like (two%)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE like '%KMF22600920%'
    Execution Time:- 6.43989658 seconds
    Returns 2 resultsets
    In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
    4) SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
    Execution Time:- Infinite
    ResultSets:- No as execution time is infinite
    a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
    b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
    Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
    Could you please let us know what is the issue with two % used in like and rownum
    5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
    SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
    Execution Time:- 7.41368914 seconds
    Returns 2 resultsets
    Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?

    This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.

  • Performance issue while updating the  custom  infotype records

    Hi All
    i have the info type with 80,000 records my requirement is to change the infotype wage type value to the  certain hard coded values .
    after populating the final internal table , in loop i am passing the records and updating the info type by using the hr_infotype_operation function module
    i have done the coding like bellow .
    loop at lt_infotype assigning     < x>
    at new pernr.
    bapi_employee_enquee
    endat.
    hr_infotype_operation
    at end of pernr .
    bapi_employee_dequee.
    endat.
    end loop.
    but it is taking nearly 15 hours to update all the records .please suggest me better solution for reducing the execution time .
    Thanks & Regards ,
    pramodh.m

    The delay problem can be solved with HR_INFOTYPE_OPERATION by using it with another FM i.e. HR_PSBUFFER_INITIALIZE the delay happens because of buffer problem. Use HR_PSBUFFER_INITIALIZE inside the loop just before you call HR_INFOTYPE_OPERATION and you wont see that much delay.

  • I have a website for my artwork.  I had a PC and. Now an iMAC.  I've used Dreamweaver to update the website.  I used to go to Filezilla on the PC a upload the updated pages which would then show updated on the internet.  What file like FileZilla should I

    I have a website for my artwork.  I had a PC and. Now an iMAC.  I've used Dreamweaver to update the website.  I used to go to Filezilla on the PC a upload the updated pages which would then show updated on the internet.  What file like FileZilla should I use?

    You can download it here:
    https://filezilla-project.org/download.php?show_all=1
    Click the Source Forge link - make sure you reject offers for any other software during the installation, Source Forge usually will ask you to install other stuff in addition to what you want (Filezilla).
    It works well on Mac.
    Dreamweaver also has built-in FTP functionality if you want to check that out.

  • [svn:osmf:] 10551: Updated the media player to use the RegionSprite.

    Revision: 10551
    Author:   [email protected]
    Date:     2009-09-23 16:16:29 -0700 (Wed, 23 Sep 2009)
    Log Message:
    Updated the media player to use the RegionSprite.
    Modified Paths:
        osmf/trunk/apps/samples/framework/MediaPlayer/src/com/adobe/strobe/players/MediaPlayerWra pper.as

    It has changed and it is bloated enough as it is.  Since the early days they have added Ping, Match, Genius, a whole media store interface, concomitant movie playing, the whole syncing business with a multitude of i-devices.
    There is no need to add a DVD player since DVD Player stands alone quite nicely as it is.  Additionally Apple is phasing out DVDs (note the demise of iDVD, all software now being downloads only, and the disappearance of DVD drives from newer models) since of course you're supposed to just get your movies from the iTunes Store.

  • [svn:bz-3.x] 15200: Update the build.xml to include contents under / resources/clustering/2.9.0

    Revision: 15200
    Revision: 15200
    Author:   [email protected]
    Date:     2010-04-02 07:46:55 -0700 (Fri, 02 Apr 2010)
    Log Message:
    Update the build.xml to include contents under /resources/clustering/2.9.0
    Modified Paths:
        blazeds/branches/3.x/build.xml

    Revision: 15200
    Revision: 15200
    Author:   [email protected]
    Date:     2010-04-02 07:46:55 -0700 (Fri, 02 Apr 2010)
    Log Message:
    Update the build.xml to include contents under /resources/clustering/2.9.0
    Modified Paths:
        blazeds/branches/3.x/build.xml

  • Update the passed XML in a PL/SQL procedure and then use DBMS_XMLSAVE

    hi folks,
    This is a great forum and most of you guys were awesome in replying to complex queries........
    I have a small issue, I am trying to do a bulk insert from my application by constructing an XML result set and pass that XML to the SP as a CLOB and using DBMS_XMLSAVE package to insert it to the oracle table. It works like a charm for me when this is as straight forward as this. But when my requirement is, I need to generate sequence numbers for a particular column (Primary key column), while for other columns I pass values from the UI (as a XML object which my SP accepts as a CLOB), i am at a loss for solution to achieve this. It would mean, that I have to generate the sequence numbers for each row and then update this value to the passed XML clob. Any indicators on how to achieve this?
    I found this solution at one of the thread which might most probably help me,
    declare
    2 l_cnt number;
    3 begin
    4 select count(*) into l_cnt from books,xmltable('/Books/Book' passing object_value);
    5 for i in 1..l_cnt loop
    6 update books set object_value =
    7 updatexml(object_value,'/Books/Book['||i||']/BookID', xmlelement("BookID",sequence_bookid.nextval))
    8 where existsnode(object_value,'/Books/Book['||i||']')=1;
    9 end loop;
    10 end;
    11 /
    But here, they are trying to update a XMLTable book, but in my case the XML is a clob object and not a XML table. Will this solution work for my case as well? Please provide any pointers to me... Thanks...

    First if your version of Oracle has DBMS_XMLSTORE, use that instead.
    Reason: {thread:id=876376} (See Marco's response).
    It is possible you could run into issues, but you should start with DBMS_XMLSTORE.
    Since you will have the XML in the SP, treat the data as an XMLType instead of a CLOB for as long as you can since you need to do UpdateXML on it.
    For your sample PL/SQL code, lines 4-5 are replaced with the WHILE loop shown in Method 2 at
    {message:id=3610259}.
    The UPDATE would be replaced with the following pseudocode
    SELECT UPDATEXML(<l_xmltype_variable>, ...)
    INTO <l_xmltype_variable>
    FROM dual;
    Once your loop is done, l_xmltype_variable would contain your updated XML and then you can use that XMLType directly on the call to DBMS_XMLSTORE or convert it back to a clob via
    l_clob_variable := l_xmltype_variable.getClobVal();

Maybe you are looking for

  • Three or four Seagate 750 GB drives in MacPro?

    I have three 750 GB Seagate drives waiting for my MacPro when it arrives on 9/19; it has the standard 250 GB Apple drive. I would like to add the three drives, and ultimately, add a fourth 750 GB Seagate to replace the 250 GB drive. I won't be using

  • Update Lot Number using API

    Hi Gurus, We get ship confirm details from an outside warehouse for our sales order and we use shipping APIs to automatically ship confirm it in Oracle. Going forward we want to get Lot number from the warehouse and we want to add it to our existing

  • Premier Pro CS6 not listed in Apps in Creative Cloud

    I need Encore CS6, but that comes with Premier Pro CS6 and that is not listed my Apps panel of Creative Cloud.

  • BB8800 - multiple calendars created on device after upgrading to 4.5

    i recently upgraded to v4.5. after initial synchronization, there were 2 calendars on the device: "device default" and the on associated with my email address. i cannot get the events from the default calendar on the device over to microsoft outlook.

  • I am unable to open Superior drummer in Logic.

    I am unable to open Superior drummer in Logic pro X. I have uninstalled and reinstalled superior drummer twice in an attempt to troubleshoot any mistake that may have been made during installation. Is there any reason that logic might not detect SD I