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!

Remove Whitespace from Node's text

BoneistMar 18 2013 — edited Mar 19 2013
Hi,

We're in the proces of migrating our 10.2.0.4 db to 11.2.0.3, and have discovered an issue with one of our queries - basically, we extract a node's text as a number, and if that node consists of whitespace only, it's now returning a 0 in 11.2.0.3 rather than the NULL it used to return in 10.2.0.4 (and earlier versions).

Here's the examples I've been working with:
select extract(xmltype('<root><test> </test></root>'), '/root/test/text()').getnumberval() from dual;
select extract(xmltype('<root><test>
</test></root>'), '/root/test/text()').getnumberval() from dual;
I've raised an SR with Oracle, due to the difference in behaviour from our 10g db, but in the meantime, I need to workaround this issue. Is there a neat way of removing whitespace from the node's text? I'd rather avoid having to convert the xmltype back to a clob to do a replace, or extracting the node as text and then trimming/replacing and converting it to a number, if at all possible.
This post has been answered by odie_63 on Mar 18 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 16 2013
Added on Mar 18 2013
20 comments
2,784 views