oracle xmltype etract max value

create table xml_tab(xml XMLType);


insert into xml_tab values ('
<root>
 <item>
  <d>2002-05-30T09:00:00</d>
 </item>
 <item>
  <d>2005-05-30T09:00:00</d>
 </item>
 <item>
  <d>2003-05-30T09:00:00</d>
 </item>
</root>');


  select max(A) from(  
 select  extractValue(value(addr), '/d') as a
from XML_TAB i,
    table(XMLSequence(
    extract(i.xml, '/root/item/d'))) addr   
    )



refer to:
http://psoug.org/reference/xmlquery.html
http://blog.csdn.net/cds27/article/details/2138888
http://kb.cnblogs.com/a/39510/
http://space.itpub.net/16168490/viewspace-714918
http://www.stanford.edu/dept/itss/docs/oracle/10gR2/server.102/b14200/functions228.htm#CIHGGHFB

你可能感兴趣的:(sql,xmltype)