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 extract CDATA from XML?

C PatelJul 17 2008 — edited Jul 18 2008

How do I get just the value of this is a test for update RHMiscData table from CDATA in the following XML?
<p>
I've tried the following using REPLACE but need a cleaner solution for getting the values within CDATA:
</p>

SELECT t.COLUMN_VALUE.extract('/RH_MiscData/@DataName') .getStringVal() DataName,
       REPLACE(REPLACE(t.COLUMN_VALUE.extract('/RH_MiscData/text()') .getStringVal(), '<![CDATA['),']]>') Data
  FROM TABLE(xmlsequence(XMLTYPE('<Root>
                                    <RH_MiscData DataName="Whats New Text">
                                      <![CDATA[this is a test for update RHMiscData table]]>
                                    </RH_MiscData>
                                  </Root>') .extract('/Root/RH_MiscData'))) t
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 15 2008
Added on Jul 17 2008
6 comments
7,919 views