Skip to Main Content

SQL & PL/SQL

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

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
1,316 views