Skip to Main Content

DevOps, CI/CD and Automation

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!

How can I append an attribute to an xml data value?

user13176513Jun 21 2012 — edited Jun 21 2012
I want to add an attribute that doesn't exist, something like

select appendxml(metadata, '/document/@newid', 2) from mytable where id = 1; <=== NO SUCH FUNCTION.

If the attribute already exists, you can call
select updatexml(metadata, '/document/@oldid', 1) from mytable where id = 1;

I don't want to have to do string manipulation to "splice in" the new attribute, then typecast it back to an xmltype. That's a lot of work, is error prone and has performance implications.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2012
Added on Jun 21 2012
1 comment
361 views