Oracle
 sql >> Database >  >> RDS >> Oracle

Come estrarre i valori del nodo json ripetibili separatamente da XML utilizzando ORACLE SQL?

Usa XMLTABLE :

SELECT x.serviceNumber
FROM   your_table t
       CROSS JOIN
       XMLTABLE(
         XMLNAMESPACE( 'http://www.yourserver.url/json/' AS "json" ),
         '//root/Input/Body/json:object/json:array/json:object/'
         PASSING XMLTYPE(
           '<?xml version="1.0" encoding="utf-8"?>' ||
           '<root xmlns:json="http://www.yourserver.url/json/">' ||
           t.your_xml_column ||
           '</root>'
         )
         COLUMNS serviceNumber NUMBER PATH './json:string[@name="serviceNumber"]'
       ) x