通过oracle sql查询解析XMLTYPE列

时间:2017-06-02 03:01:38

标签: sql oracle xmltype

我们正在尝试解析以下格式的XMLTYPE列:

<?xml version="1.0" encoding="UTF-8"?>
<simple-record xmlns="http://www.system.com/schemas/policy">
  <record rule-id="1" rule-name="Test1 rule" rule-desc="This is the test rules." entitled-id="261" user-ent-id="" first-name="test1" last-name="test1" user-disp-name="test1, test1" ent-id="421" ent-type="app1" ent-name="Pay I" res-name="" act-name="" V-ent-type="role1" V-ent-id="421" V-ent-name="" V-res-name="" V-act-name="" bucket-id="1" app-id="61" app-name="Pay" state="OP"/>
  <record rule-id="2" rule-name="Test2 rule" rule-desc="This is the test rules." entitled-id="261" user-ent-id="" first-name="test2" last-name="test2" user-disp-name="test2, test2" ent-id="423" ent-type="app2" ent-name="Pay V" res-name="" act-name="" V-ent-type="role2" V-ent-id="423" V-ent-name="" V-res-name="" V-act-name="" bucket-id="2" app-id="61" app-name="Pay" state="OP"/>
</simple-record>


The query we tried is 
select td.ID, x.* from PV_CHANGE_REQUEST td,
XMLTABLE ('/simple-record/recod' 
          PASSING td.VIOLATIONS
            COLUMNS "ruleName" varchar2(100)  PATH '@rule-name')x 

但上面的查询给出了0结果。如果有任何遗漏,请告诉我。

0 个答案:

没有答案