Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Construir um XML com XMLELEMENT - consulta ORACLE SQL 11g


Consegui encontrar uma solução:
select XMLElement("Changes", 
              XMLElement("Description", 'sometext'),
              XMLElement("Notes", 'sometext'),
              XMLElement("FulfillmentDate", 'Some Date'),
                  XMLAgg(XML_CANDIDATE) ).GETSTRINGVAL() RESULTS

from 
(

select XMLAGG(
        XMLElement("UserChange",
        XMLElement("Operation", 'sometext'),
        XMLElement("User", 'sometext'),
        XMLElement("BusinessSource", 'sometext'),
        XMLElement("ApplicationRole", 'sometext')))  XML_CANDIDATE
from
table);