I have the following XML message:
<?xml version="1.0" encoding="UTF-8"?>
<MSH>
<MSH.1>|</MSH.1>
<MSH.2>^~\&</MSH.2>
<MSH.3>
<HD.1>LAB</HD.1>
</MSH.3>
<MSH.4>
<HD.1>767543</HD.1>
</MSH.4>
<MSH.5>
<HD.1>ADT</HD.1>
</MSH.5>
<MSH.6>
<HD.1>767543</HD.1>
</MSH.6>
<MSH.7>199003141304-0500</MSH.7>
<MSH.9>
<CM_MSG.1>ACK</CM_MSG.1>
<CM_MSG.3>ACK_ACK</CM_MSG.3>
</MSH.9>
<MSH.10>XX3657</MSH.10>
<MSH.11>
<PT.1>P</PT.1>
</MSH.11>
<MSH.12>
<VID.1>2.4</VID.1>
</MSH.12>
</MSH>
I need to convert this into the following table:
Node Level 1 Node Level 2 Node Level 3 Value
MSH MSH.1 |
MSH MSH.2 ^~\&
MSH MSH.3 HD.1 LAB
I found a way to fill value in Oracle SQL using ExtractValue. But I didn't understand how to get the different nodes in XML and value dynamically.
How can I parse XML dynamically and store in the above table format depending on the number of node levels?