I'm trying to search for a given value in a XML binary type column in a SQL table (BLOB).
The table has +3000 records. I need to look for all the values that corresponds to a specific IP in /properties/ip/ from an XML that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<port>8000</port>
<ip>12.345.67.80</ip>
</properties>
So far, I've been able to get some output but not what I needed (I could only run the query with the last WHERE claus, not without):
SELECT
d.*,
extractvalue(xmltype(d.CONFIGURATION,nls_charset_id('AL32UTF8')),'properties/ip') as ip_lookup
FROM
AZ.DEVICES d
WHERE
NAME = 'Door-Entrance';
I am interesting in looking for all records with specific IP's, so something like this:
SELECT
d.*,
extractvalue(xmltype(d.CONFIGURATION,nls_charset_id('AL32UTF8')),'properties/ip') as ip_lookup
FROM
AZ.DEVICES d
WHERE
ip_lookup = '12.345.67.80';
Any ideas?