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!

Fastest way to get an empty xmlelement without separate closing tag?

Toon KoppelaarsJan 13 2010 — edited Jan 28 2010
Hi,

Oracle 10.2.0.4

When I do this:
select xmlelement("MyTag")
from dual;
It results in: <MyTag></MyTag>

When I do this:
select xmlelement("MyTag").extract('/*')
from dual;
It results in: <MyTag/>

My requirement is to get the latter result.
However the second query (with the .extract('/*')), is 4 times as expensive, cpu-wise.

Doing this:
select XMLType('<MyTag/>')
from dual;
Is even worse yet. So also not an option.

Any other ideas?

Edited by: Toon Koppelaars on Jan 13, 2010 1:50 PM
Added Oracle version.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2010
Added on Jan 13 2010
6 comments
3,405 views