I have this xml on my db:
<requestXML>
<headers>
<name>Accept</name>
<value>text/plain, application/json, application/*+json, */*</value>
</headers>
<method>PUT</method>
<payload>{"timestamp":"1659167441820","orderIdentifierCode":"OC22004795","clientName":"XXXX","country":"XX","vatNumber":"XXXXXXXX","orderDate":"XX/XX/XXXX","orderState":"XX"}</payload>
<threadName>default task-xx</threadName>
<url>http://localhost:8080/service_name</url>
</requestXML>
I tried to perform a SELECT statement with XMLExists but with no results.
What I need is to search into <payload>
tag, inside those json body, the orderIdentifierCode
value.
Here my SELECT:
SELECT * FROM EVDA.TETSIR_LOG_WS_PBE
AS X
WHERE XMLExists('$XML//requestXML/payload[orderIdentifierCode="OC22004795"]' passing X.T_RIC_XML AS "XML")
AND D_TMS_REG BETWEEN '2022-07-27 00:00:00.000001' AND '2022-08-02 23:59:59.999999'
WITH UR;
This one, on the contrary, is working fine:
SELECT * FROM EVDA.TETSIR_LOG_WS_PBE
AS X
WHERE XMLExists('$XML//requestXML[method="PUT"]' passing X.T_RIC_XML AS "XML")
AND D_TMS_REG BETWEEN '2022-07-27 00:00:00.000001' AND '2022-08-02 23:59:59.999999'
WITH UR;
I started to think that the first one is not well formatted or that something is missing due to complex value inside the tag <payload>
.
Any guess?
Thanks in advance