How to extract repeatable json node values separately from XML using ORACLE SQL?

后端 未结 2 1111
暗喜
暗喜 2021-01-29 00:51

I have the following XML and i want to extract the values of json parameter \"serviceNumber\" separately i tried using EXTRACT function but i got the results co

2条回答
  •  别那么骄傲
    2021-01-29 01:15

    Use 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(
               '' ||
               '' ||
               t.your_xml_column ||
               ''
             )
             COLUMNS serviceNumber NUMBER PATH './json:string[@name="serviceNumber"]'
           ) x
    

提交回复
热议问题