I wanted to retrieve data with space or comma seperated from xml with same tag value e.g. Name = 'access'.Please let me know if there is any function to handle it.
I am getting below error when I try to retrieve data from xml.
SQL:
SELECT case ip_addresses when 'all' then 'all'
when 'disabled' then 'disabled'
Else
'IP'
END "ssh"
FROM (
SELECT x.* FROM ip_Details t,
XMLTABLE ( '/methodResponse/params/param/value'
PASSING a
COLUMNS
ip_addresses VARCHAR2(40) PATH 'struct/member[name="access"]/value/array/data/value/string'
) x
)
;
Output:
IP Address
----------------------------------
10.244.202.22 10.244.202.23
XML:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>access</name>
<value>
<array>
<data>
<value>
<string>10.244.202.22</string>
</value>
<value>
<string>10.244.202.23</string>
</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
Error:
ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
19279. 00000 - "XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence"
*Cause: The XQuery sequence passed in had more than one item.
*Action: Correct the XQuery expression to return a single item sequence.