Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

PL/SQL Object Type to XML with Attribute and Values

Apex_NoobJan 16 2020 — edited Jan 20 2020

Hi,

I have to create XML with too many level of nesting. For that we found creating PL/SQL object type and converting it to xml is convenient and the code is more readable. However we are facing an issue, when we have to generate both value and attribute for a tag.

Example using object I am able to generate below xml:-

1.   <Charge><Amount>200</Amount></Amount>      -----> Amount tag without attribute

create or replace type "Charge" as object("Amount" number);

2.   <Charge><Amount ccy="USD"/> </Charge>         ------> Amount Tag with attribute

create or replace type "Charge" as object("@Amount" number);

However, I am not able to create object to generated below xml

3.  <Charge> <Amount ccy="USD">200</Amount></Charge>

How, to create PL/SQL Object type so that it should be able to generate tag with both attribute and value as in point 3.

Thanks and Regards,

Shijesh

Comments
Post Details
Added on Jan 16 2020
10 comments
715 views