sql >> Base de Datos >  >> RDS >> Oracle

Cree un XML con XMLELEMENT - consulta ORACLE SQL 11g

Pude encontrar una solución:

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);