escape characters in xpath
421886Feb 26 2007 — edited Feb 26 2007Hello,
I use the folowing statement to retrieve xml data:
select p.pack_content from packages p
where existsNode(p.pack_content,'/WEZEL/KONTRAHENCI/KONTRAHENT[AKRONIM="acronim_value"]')=1
The statement is generated in Java and the value of XPath condition changes depending on the acronim_value:
For acronim_value=BC
the statement looks like:
select p.pack_content from packages p
where existsNode(p.pack_content,'/WEZEL/KONTRAHENCI/KONTRAHENT[AKRONIM="BC"]')=1
The problem is that acronim_value maybe "BC
so the statement is the following:
select p.pack_content from packages p
where existsNode(p.pack_content,'/WEZEL/KONTRAHENCI/KONTRAHENT[AKRONIM=""BC"]')=1
I get ora-31013 error as the xpath is invalid. How should I write the statement to escape " double qoutation character to create valid xpath.
Grzegorz.