Oracle使用Sql把XML解析成表(Table)的方法
Posted Twang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle使用Sql把XML解析成表(Table)的方法相关的知识,希望对你有一定的参考价值。
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)的方法的主要内容,如果未能解决你的问题,请参考以下文章
sql把字符数组转换成表 :把字符串1,2,3变成表里的行数据