Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update multiple nodes in a row in a single query

523496Sep 5 2006 — edited Sep 5 2006
Hi

I use updateXML to change the value of a node in each row
of an XML table (structured storage). For example, if I
have the three following documents in the table:

<doc>
<elem>1</elem>
</doc>

<doc>
<elem>2</elem>
</doc>

<doc>
<elem>1</elem>
</doc>

I can change the @val value to "3" where it is equal to
"1" by using:

UPDATE my_table
SET OBJECT_VALUE = updateXML(OBJECT_VALUE, '/doc/elem/text()', '3')
WHERE existsNode(OBJECT_VALUE, '/doc/elem/text() = "1"') = 1;

But how to achieve the same goal when there are several
nodes to update in a row, as updateXML can only update a
single node? For example, how to make the same update as
the example above, but with the following documents in the
table:

<doc>
<elem>1</elem>
</doc>

<doc>
<elem>2</elem>
</doc>

<doc>
<elem>1</elem>
<elem>1</elem>
</doc>

Thanks in advance.

Regards,

--drkm
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2006
Added on Sep 5 2006
1 comment
960 views