Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XmlExists Search with Ampersand in Search String.

user11044Jun 15 2009 — edited Jul 8 2009
Greetings All, I am having a particular issue with XmlExists searching for data that has an ampersand.

I am running 11g patchset 12.
Table being searched is using sys.xmltype to persist xml document.

DDL:
CREATE TABLE "XML_TEST"
(
AccountID RAW(16) NOT NULL ENABLE,
TenantID RAW(16) NOT NULL ENABLE,
CustomFields "SYS"."XMLTYPE"
) ;


DML:

declare clobVal clob;

BEGIN

-- INSERT #1
clobVal := '<?xml version="1.0" encoding="utf-8"?>
<ArrayOfCustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CustomField ReferencedID="3A887DE7B2FA4A19B9F66FCC19E02062">
<StringValue>Guitar</StringValue>
</CustomField>
<CustomField ReferencedID="014F2EFA42CF40829A9A5FB761759071">
<StringValue>Louis &amp; Clark</StringValue>
</CustomField>
<CustomField ReferencedID="59690AD42A5B4C83B4917D024908F905">
<NumberValue>12.48</NumberValue>
</CustomField>
<CustomField ReferencedID="06675CD4B0FD4C769C3266260159EAC4">
<DateValue>1242394042</DateValue>
</CustomField>
</ArrayOfCustomField>';

INSERT INTO XML_TEST (AccountID, TenantID, CustomFields)
VALUES ('ADDA071176A94654A2BE2129A1ABFBF9', 'F068F6D54ED2DB11ABE500188B001DE0', xmltype(clobVal));


Here is the problem element:

<StringValue>Louis &amp; Clark</StringValue>


When I run this query:

SELECT count(*)
FROM XML_TEST
WHERE XMLExists('/ArrayOfCustomField/CustomField[@ReferencedID="014F2EFA42CF40829A9A5FB761759071"]/StringValue[. = "Louis %26amp; Clark"]' PASSING CustomFields);

It does not return the expected result?

Not does this query:

SELECT count(*)
FROM XML_TEST
WHERE XMLExists('/ArrayOfCustomField/CustomField[@ReferencedID="014F2EFA42CF40829A9A5FB761759071"]/StringValue[. = "Louis &amp; Clark"]' PASSING CustomFields);


Any and all help would be greatly appreciated.

L
This post has been answered by mdrake-Oracle on Jun 15 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2009
Added on Jun 15 2009
11 comments
2,893 views