简体   繁体   中英

XPath query in DB2

I'm performing the following query in DB2 on a XML column and it works fine:

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". The error message is ""IQQS0032E The query cannot be processe".

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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