How to read a CLOB file and choose one of the node

I have the table with one of its datatyp as CLOB, I need to read a particular node only.
Ex
Table tesxml has two ColonneD id, xml and the xml field is a CLOB that includes data as shown below.
<?xml version="1.0" encoding="UTF-8"?>
<alert>
     <type0 comment="section in XSL component" name="Initial Information">
          <details>     
               <Priority>0001</Priority>
               <Date>2010-06-29</Date>
               <Initial_Information></Initial_Information>
          </details>
                  </type0>
</alert>
now I need to select id, < value(from xml) Date >, < value comment >

o/p should look like
0000,2010-06-29,section in XSL component
I tried these queries, but I'm doing something wrong with the syntax...
SELECT alert_internal_id,EXTRACTVALUE(VALUE(c), '/Date') datee
  FROM (SELECT id,xmltype(xml) xml FROM tesxml),
       table(XMLSEQUENCE(EXTRACT(xml, '/alert/type0/details/'))) c;


select dbms_lob.read(HTML_FILE_KEY,alert,type0,details,Date) from alerts

MichaelS says:
What is your version of db?

You can do it in 11 GR 2

or even 10g...

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> with t as (
  2  select xmltype('
  3      
  4          
5 0001 6 2010-06-29 7 8
9
10
') xml from dual 11 ) 12 -- 13 -- 14 select x.* 15 from t, 16 xmltable ('.' passing xml 17 columns prio varchar2 (5) path '/alert/type0/details/Priority', 18 dt varchar2 (15) path '/alert/type0/details/Date', 19 type_comment varchar2 (25) path '/alert/type0/@comment') x 20 / PRIO DT TYPE_COMMENT ----- --------------- ------------------------- 0001 2010-06-29 section in XSL component SQL>

Tags: Database

Similar Questions

Maybe you are looking for