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

Come selezionare valori specifici da XML utilizzando Oracle Xquery

Ho trovato una risposta:

select t.*
        from xmltable(xmlnamespaces(default 'http://www.opengis.net/wfs'
                                   ,'http://www.opengis.net/gml' as "gml"
                                    ,'http://www.opengis.net/wfs' as "wfs"
                                    ,'http://www.opengis.net/ows' as "ows"
                                    ,'http://www.w3.org/1999/xlink' as "xlink"
                                    ,'http://www.w3.org/2001/XMLSchema-instance' as "xsi"
                                    ,'http://www.opengis.net/ogc' as "ogc")
                      ,'for $d in //ows:Operation/ows:Parameter/ows:Value
                        where $d/../../@name = "GetFeature"
                        and $d/../@name="outputFormat"
                        return $d' passing p_xml columns value varchar2(100) path '/') as t;

utilizzando l'espressione .. xpath per accedere ai nodi principali.