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!

XML parsing using extractvalue method

user601042Jan 17 2011 — edited Jan 18 2011
Hi,
When i use the following data for XML paring its working fine. That is no space inbetween two colons

Query 1:
SELECT ':'||extractValue(x.column_value, '/EMPDETAIL/tranCode')||':' as emp_id
FROM TABLE(
XMLSequence(
Extract( xmltype('<?xml version="1.0" encoding="utf-8"?>
<EMPDETAIL>
<tranCode>008</tranCode>
</EMPDETAIL>'),'/EMPDETAIL'))) x

When i split tranCode tag details as mentioned below format(ie is not in same row) its not working (working but spaces are there between two colons)

Query 2:SELECT ':'||extractValue(x.column_value, '/EMPDETAIL/tranCode')||':' as emp_id
FROM TABLE(
XMLSequence(
Extract( xmltype('<?xml version="1.0" encoding="utf-8"?>
<EMPDETAIL>
<tranCode>
008
</tranCode>
</EMPDETAIL>'),'/EMPDETAIL'))) x

When i use the above data , its taking null value as output and program is raisng exception.

What functionality i have to add in second query so that output of query 2 is same as output of query 1.

Thanks for your help!

Edited by: user601042 on Jan 17, 2011 5:11 AM

Edited by: user601042 on Jan 17, 2011 5:12 AM

Edited by: user601042 on Jan 17, 2011 5:16 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2011
Added on Jan 17 2011
8 comments
991 views