Skip to Main Content

DevOps, CI/CD and Automation

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!

extract function is returning multiple values in same row ...

Sam7771Oct 7 2011 — edited Oct 7 2011
Hi i am using 11g Release2, 64 bit oracle database.

Question is

1)Below is the code i am using,

WITH T AS (SELECT XMLTYPE('<ALL_REGIONS>
<COUNTRY_CODE>
<COUNTRY ID="001"/>
<COUNTRY ID="002"/>
<COUNTRY ID="003"/>
<COUNTRY ID="004"/>
<COUNTRY ID="005"/>
</COUNTRY_CODE>
</ALL_REGIONS>') XMLCOL
FROM DUAL)
SELECT EXTRACT(VALUE(X),'/ALL_REGIONS/COUNTRY_CODE/COUNTRY/@ID') as "id" from t,TABLE(XMLSequence(extract(t.xmlcol,'/'))) x;

2)Output is

id
-------------------
001002003004005
1 row selected.

3)I need output to be like

id
--------------------
001
002
003
004
005


Can Anyone tell me how to do so, it's urgent ..... please mail to lokesh3012@live.com
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2011
Added on Oct 7 2011
3 comments
894 views