码迷,mamicode.com
首页 > 数据库 > 详细

Oracle使用Sql把XML解析成表(Table)的方法

时间:2017-03-15 18:33:08      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:class   ima   ora   pass   hive   img   sel   dea   select   

SELECT * FROM XMLTABLE($B/DEAL_BASIC/USER_DEAL_INFO PASSING
    XMLTYPE(<?xml version="1.0" encoding="gb2312" ?>
              <DEAL_BASIC>
                 <USER_DEAL_INFO>
                     <USER_DEAL_ID>1000100001</USER_DEAL_ID>
                     <DEAL_INURE_TIME>20081130</DEAL_INURE_TIME>
                     <DEAL_EXPIRE_TIME>30000101</DEAL_EXPIRE_TIME>
                     <DEAL_CREATE_TIME>20081130</DEAL_CREATE_TIME>
                 </USER_DEAL_INFO>
                 <USER_DEAL_INFO>
                     <USER_DEAL_ID>1000100002</USER_DEAL_ID>
                     <DEAL_INURE_TIME>20081131</DEAL_INURE_TIME>
                     <DEAL_EXPIRE_TIME>30000102</DEAL_EXPIRE_TIME>
                     <DEAL_CREATE_TIME>20081131</DEAL_CREATE_TIME>
                 </USER_DEAL_INFO>
              </DEAL_BASIC>) AS B
    COLUMNS USER_DEAL_ID VARCHAR2(50) PATH
    /USER_DEAL_INFO/USER_DEAL_ID,
    DEAL_INURE_TIME VARCHAR2(50) PATH
    /USER_DEAL_INFO/DEAL_INURE_TIME,
    DEAL_EXPIRE_TIME VARCHAR2(50) PATH
    /USER_DEAL_INFO/DEAL_EXPIRE_TIME,
    DEAL_CREATE_TIME VARCHAR2(50) PATH
    /USER_DEAL_INFO/DEAL_CREATE_TIME)

结果:

技术分享

参:Oracle使用Sql把XML解析成表(Table)的方法

 

Oracle使用Sql把XML解析成表(Table)的方法

标签:class   ima   ora   pass   hive   img   sel   dea   select   

原文地址:http://www.cnblogs.com/wangfuyou/p/6555405.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!