Skip to Main Content

DevOps, CI/CD and Automation

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

extract relational data from xml - xquery

3230404Oct 21 2018 — edited Oct 25 2018

our application stores all data as xml in oracle database, for example i have the below data as appear in the browser:

2018-10-21_14h10_57.png

in database the record appear like this:

<row id="111">

<c1>10</c1>

<c1 m="2">11</c1>

<c1 m="3">12</c1>

<c1 m="4">13</c1>

<c1 m="5">14</c1>

<c1 m="6">15</c1>

<c2/>

<c2 m="2">100</c2>

<c2 m="2" s="2">200</c2>

<c2 m="4">300</c2>

<c2 m="6">400</c2>

<c2 m="6" s="2">700</c2>

<c2 m="6" s="3">600</c2>

<c2 m="6" s="4">500</c2>

<c3 m="6"/>

<c4 m="6"/>

<c5 m="6"/>

<c11>1</c11>

<c12>297_LUAY1__OFS_BROWSERTC</c12>

<c13>1810211410</c13>

<c14>297_LUAY1_OFS_BROWSERTC</c14>

<c15>PS0010001</c15>

<c16>1</c16>

</row>

as u see above c1 holds the owner data, c2 holds the transactions data... and so on..

in the above example the first "c2" node appear like <c2/> becuase it has no transactions in it. however if it has it will appear like this <c2>"some transaction number"</c2>

now from database i want to extract this data as below:

| Owner | Transaction |
| 10 | |
| 11 | 100 |
| 11 | 200 |
| 12 | |
| 13 | 300 |
| 14 | |
| 15 | 400 |
| 15 | 700 |
| 15 | 600 |
| 15 | 500 |

any help plz....

BR

This post has been answered by mNem on Oct 22 2018
Jump to Answer

Comments

Post Details

Added on Oct 21 2018
10 comments
516 views