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!

One-Row Multiple-Columns from an XML text

user3292382Mar 12 2018 — edited Mar 13 2018

Hello,

by executing a query using a "pivot xml" instruction, I get the following XMLType result:

<PivotSet>

   <item>

      <column name = "ITEM">ALPHA</column>

      <column name = "VALUE">10</column>

   </item>

   <item>

      <column name = "ITEM">BETA</column>

      <column name = "VALUE">20</column>

   </item>

   <item>

      <column name = "ITEM">GAMMA</column>

      <column name = "VALUE">30</column>

   </item>

</PivotSet>

(The number of <item>s is unknown, it depends on the result of the originating query).

Starting from that result, I need a result with one row and as many columns as the items.

For instance, using the above, the final result must be:

ALPHA      BETA      GAMMA

---------  --------  ---------

10         20        30

Maybe using some XML functions, like EXTRACT or EXTRACTVALUE?

Thank you in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 10 2018
Added on Mar 12 2018
12 comments
1,809 views