在这样的查询中,我遇到了由错误的xpath(属性谓词中缺少'@')导致的性能问题:
从table中选择extractvalue(field,'// item [attr ="value"]'),其中field1 =:1;
我期待一个异常,但似乎Oracle接受这个特殊的xpath,有意义吗?
我试图针对该查询执行解释计划,但结果很奇怪,有人可以帮我理解吗?
我用这段代码重现了这个环境
SELECT * FROM V$VERSION;
/*
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production"
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
*/
create table TMP_TEST_XML(
id number,
content_xml xmltype
);
/
create unique index IDX_TMP_TEST_XML on TMP_TEST_XML(id);
/
declare
xml xmltype := xmltype('<root>
<a key="A">Aaa</a>
<b key="B">Bbb</b>
<c key="C">Ccc</c>
<d key="D">Ddd</d>
<e key="E">Eee</e>
<f key="F">Fff</f>
<g key="G">Ggg</g>
<h key="H">Hhh</h> …Run Code Online (Sandbox Code Playgroud)