我在弄清楚如何将名称空间集成到具有xml存在的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"]'
);
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