Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get specific xml attributes only?

ronald_2017Mar 22 2024 — edited Mar 22 2024

Hello All,

I use Oracle 19c, is there any way to get the following data from the below xml?

spans="1:5" ht="15" thickTop="1" x14ac:dyDescent="0.3"
spans="1:5" x14ac:dyDescent="0.3"
spans="1:5" x14ac:dyDescent="0.3"
spans="1:5" x14ac:dyDescent="0.3"
select xmltype(q'~<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac xr xr2 xr3" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" 
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" 
xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xr:uid="{00000000-0001-0000-0000-000000000000}">
   <sheetData>
    <row r="1" spans="1:5" ht="15" thickTop="1" x14ac:dyDescent="0.3">
      <c r="A1" s="1"/>
      <c r="B1" s="2"/>
      <c r="C1" s="2"/>
      <c r="D1" s="2"/>
      <c r="E1" s="3"/>
    </row>
    <row r="2" spans="1:5" x14ac:dyDescent="0.3">
      <c r="A2" s="4" t="s">
        <v>0</v>
      </c>
      <c r="B2" s="5"/>
      <c r="C2" s="6"/>
      <c r="D2" s="6" t="s">
        <v>27</v>
      </c>
      <c r="E2" s="7"/>
    </row>
    <row r="3" spans="1:5" x14ac:dyDescent="0.3">
      <c r="A3" s="4" t="s">
        <v>1</v>
      </c>
      <c r="B3" s="5"/>
      <c r="C3" s="6"/>
      <c r="D3" s="6"/>
      <c r="E3" s="7"/>
    </row>
    <row r="4" spans="1:5" x14ac:dyDescent="0.3">
      <c r="A4" s="4" t="s">
        <v>2</v>
      </c>
      <c r="B4" s="5"/>
      <c r="C4" s="6"/>
      <c r="D4" s="8"/>
      <c r="E4" s="7"/>
    </row>
  </sheetData>
</worksheet>~')
from dual;

Thanks in advance

This post has been answered by Solomon Yakobson on Mar 22 2024
Jump to Answer
Comments
Post Details
Added on Mar 22 2024
5 comments
446 views