简体   繁体   English

DB2中的XPath查询

[英]XPath query in DB2

I'm performing the following query in DB2 on a XML column and it works fine: 我正在DB2的XML列上执行以下查询,并且工作正常:

SELECT  
FROM customer
WHERE contains(search_text, 
'
@xpath:''/customer/number[. contains("123456")]''
', 'RESULTLIMIT = 100')=1;

but the following query doesn't work: 但是以下查询不起作用:

SELECT  
FROM customer
WHERE contains(search_text, 
'
@xpath:''/customer/number[. = "123456"]''
', 'RESULTLIMIT = 100')=1;

Any ideas why the second query doesn't work? 任何想法为什么第二个查询不起作用? The error I get is: ERROR [38H10] [IBM][DB2/LINUXX8664] SQL20423N Error occurred during text search processing on server "localhost" using index "CISC_CUSTOMER". 我得到的错误是:错误[38H10] [IBM] [DB2 / LINUXX8664] SQL20423N使用索引“ CISC_CUSTOMER”在服务器“本地主机”上的文本搜索处理期间发生错误。 The error message is ""IQQS0032E The query cannot be processe". 错误消息为““ IQQS0032E无法处理查询”。

<customer>
<number>
123456
</number>
<firstname>
John 
</firstname>
<lastname>
Smith
</lastname>
</customer>

在DB2中,您只能在属性上使用“ =”,而在元素上只能使用“ contains”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM