Return all XML elements in separate columns
Posted on 2010-11-22
SELECT XMLELEMENT("Cust", XMLFOREST(d.ID,
d.last_name)) "Cust Element"
FROM MyTable d
This query returns these 4 fields in XML. If I want to write a query that will get all the columns into the XML without being explicitly named...
This seems to work, but I'm not sure if it is the most elegant solution...
select value (e).GETCLOBVAL() as "xmltype"
FROM TABLE(XMLSequence(Cursor(SELECT * FROM MYTABLE))) e;
Thanks for your advice...