Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> xml data to columns table

xml data to columns table

From: <inluvwitiou_at_bluemail.ch>
Date: 10 May 2005 03:00:02 -0700
Message-ID: <1115719202.518869.81110@o13g2000cwo.googlegroups.com>


Hi all,

Assuming i have this xml fragment, stored in a column named xmldata of CLOB type, in a table
'<Warehouse>

<WarehouseId>1</WarehouseId>
<WarehouseName>Montreal, Quebec</WarehouseName>
</Warehouse>
<Warehouse>

<WarehouseId>2</WarehouseId>
<WarehouseName>Southlake, Texas</WarehouseName>
</Warehouse>
'

How can i generate in one query, the xml elements to have them in columns table format ?

I know, i could do something like

select
extractvalue(a.xmldata,'//Warehouse/WarehouseId') id, extractvalue(a.xmldata,'//Warehouse/WarehouseName') name from mytable a

Result


id       name
1        Montreal, Quebec
2        Southlake, Texas

and that would satisfy my needs. But, what if i have many more xmlelements inside my xml ? I wouldn't like to select each column by each column as above. In fact, i'm looking something equal to the "select *" but from an xmldata so that it is directly splitted into the right number of columns, based on the xml elements. Is that clear for anybody ..?
Thanks for helping,
Regards,
Mike. Received on Tue May 10 2005 - 05:00:02 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US