0

我在弄清楚如何将命名空间集成到具有 xmlexists 的 where 子句时遇到问题。查询如下:

SELECT sing_d1.sing_info_text1, sing_d1.sing_info_text2
FROM XMLTABLE(
      xmlnamespaces (
                       'http://www.abccompany.com/Canonical' AS "abc",
                       'http://abccompany.com/PmtInfo' AS "pmt",
                       'http://abccompany.com/CommonTypes' AS "cmn",
                       'http://www.w3.org/2001/XMLSchema-instance' AS "xsi"),
                   '/abc:abc/abc:Pmt/pmt:Payments/pmt:PayInfo/pmt:Single/pmt:SingAddInfo'
                    PASSING payXml
                    COLUMNS 
                                  sing_info_type VARCHAR2(4000)
                                  PATH 'cmn:AddInfoCmpType',
                                  sing_info_text1 VARCHAR2(4000)
                                  PATH 'cmn:AddInfoCmpText[1]',
                                  sing_info_text2 VARCHAR2(4000)
                                  PATH 'cmn:AddInfoCmpText[2]'
              )sing_d1
WHERE 
                       XMLExists(

                   '/abc:abc/abc:Pmt/pmt:Payments/pmt:PayInfo/pmt:Single/pmt:SingAddInfo[AddInfoCmpType = "IATCode"]'

);

任何线索将不胜感激。

4

1 回答 1

1
   XMLExists('   declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance";
                declare namespace abc="http://www.abccompany.com/Canonical";
                        declare namespace pmt="http://abccompany.com/PmtInfo";
                        declare namespace cmn="http://abccompany.com/CommonTypes";
                          /abc:abc/abc:Pmt/pmt:Payments/pmt:PayInfo/pmt:Single/pmt:SingAddInfo[AddInfoCmpType = "IATCode"]' passing payXml)

对于 xmlns(默认)使用declare default element namespace "http.url.url". 对于他人 declare namespace xyz

于 2016-11-07T14:40:54.283 回答