首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

ORACLE EXTRACT()跟EXTRACTVALUE() 使用

2012-07-26 
ORACLE EXTRACT()和EXTRACTVALUE() 使用drop table tcreate table t(text xmltype)INSERT INTO t VALUES

ORACLE EXTRACT()和EXTRACTVALUE() 使用

drop table t;

create table t(text xmltype);

INSERT INTO t VALUES (XMLType.CreateXML(
'<?xml version="1.0"?>
<fall>
<name>dingjun123</name>
<county>china</county>
<state>xxx</state>
<url>
http://michiganwaterfalls.com/autrain_falls/autrain_falls.html
</url>
</fall>'));

INSERT INTO t VALUES (XMLType.CreateXML(
'<?xml version="1.0"?>
<fall>
<name>jack</name>
<county>china</county>
<state>yyyy</state>
<url>
http://michiganwaterfalls.com/autrain_falls/autrain_falls.html
</url>
</fall>'));
commit;

select extractValue(value(m), '/fall/name') name,
extractValue(value(m), '/fall/county') county,
extractValue(value(m), '/fall/state') state
      from t,
           table( xmlsequence(extract(t.text,'/fall'))) m ;

参考链接:http://www.itpub.net/thread-1477782-1-1.html

热点排行