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!

How to generate an XML empty tag

User_RFKSXMay 5 2021

Hi,
if I execute a select like this

select xmlelement("start",
xmlelement("name",T.NAME),
xmlelement("sirname",T.SIRNAME),
)
from mytable T;

and for example the SIRNAME is null, I get

<start>
<name>John</name>
<sirname></sirname>
</start>

but if I wanted to get an XML sintax like this, that is another way to generate empty tags

<start>
<name>John</name>
<sirname/>
</start>

how can I get it?
Probably the two ways are equivalent, but is there a way to generate the second one?

Oracle version 10g

Thanks in advance!
Mark

Comments
Post Details
Added on May 5 2021
2 comments
2,228 views