易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle xmltype简介

找不到原帖了  就贴这里吧!
在向大家详细介绍Oracle之前,首先让大家了解下Oracle xmltype是什么,Oracle从9i开始支持一种新的数据类型----
xmltype,用于存储和管理xml数据,并提供了很多的functions,用来直接读取xml文档和管理节点。下面将介绍Oracle
xmltype的一些基本使用。
1.建立含有Oracle xmltype数据类型的表create table abc (id number,xmldoc
sys.xmltype);声明xmltype型字段用:sys.xmltype。
2.向带有xmltype类型的表插入带有数据insert into abc (id,xmldoc) value (abc.nextval ,
sys.xmlType.createXML(''<name><a id="1" value="some
values">abc</a></name>'') );插入用
sys.xmlType.createXML(''some xml doc'')
3.直接查询Oracle xmltype字段里面的内容得到id=1的value变脸的值select
i.xmldoc.extract(''//name/a[@id=1]/@value'').getStringVal() as ennames,
id from abc i得到a节点的值select id,
i.xmldoc.extract(''//name/a/text()'').getStringVal() as truename from
abc i得到节点id属性的值Select
hd.Data_t.extract(''/root/name/@id'').getStringVal()    As Name from
sehr_house_data hd
4.更新Oracle xmltype里面的数据update abc set
xmldoc=updateXML(xmldoc,''//name/a[@id=1]/@value'',''some new value'')
where ......(注意:如果里面没有<a id="1">这个节点,将不能update)
5.添加超过4k字节的xml文档到xmltype型字段可以通过使用临时表的办法实现:
◆先建立一个临时的表,其中的一个字段是clob
类型;
◆再将要写入xmltype字段的xml doc写入这个临时的clob型的字段中;
◆最后insert into abc
(id,xmldoc) values (abc_q.nextval , sys.xmlType.createXML((select
content from 临时表 where id=......)));


相关文档:

Oracle左右全连接总结

--建立测试数据
create table a(id number);
create table b(id number);
insert into a values(1);
insert into a values(2);
insert into a values(3);
insert into b values(1);
insert into b values(2);
insert into b values(4);
commit;
--左:
--主流数据库通用的方法
select * from a left ......

oracle日期函数

oracle日期函数,
      TO_DATE格式
  Day:
  dd number 12
  dy abbreviated fri
  day spelled out friday
  ddspth spelled out, ordinal twelfth
  Month:
  mm number 03
  mon abbreviated mar
  month spelled out march
  Year:
  yy two ......

Oracle Finalizes Acquisition of Sun


We are pleased to announce that Oracle has completed its acquisition of Sun Microsystems and Sun is now a wholly owned subsidiary of Oracle. With this news, we want to reiterate our commitment to deliver complete, open and integrated systems that help our customers improve the performance, reliabi ......

oracle日期函数集锦

一、 常用日期数据格式
1.Y或YY或YYY 年的最后一位,两位或三位
SQL> Select to_char(sysdate,'Y') from dual;
TO_CHAR(SYSDATE,'Y')
--------------------
7
SQL> Select to_char(sysdate,'YY') from dual;
TO_CHAR(SYSDATE,'YY')
---------------------
07
SQL> Select to_char(sysdate,'YYY') from d ......

Create Oracle Data Source

在Stand alone的环境中创建Oracle data source供测试使用:
   OracleDataSource dataSource = new OracleDataSource();
   dataSource.setDriverType("oracle.jdbc.driver.OracleDriver");
   dataSource.setURL("jdbc:oracle:thin:@localhost:1521:ORCL");
   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号