I need to generate XML using Oracle object types and element will have attributes. The complication is both element and attribute will have values as below
employee> ename id=100>Aaron /ename> /employee>
Requirement is to achieve this with object types only ,not to use xmlelement,xmlattributes since real scenario contains numerous number of columns.
Create or replace type ename_type as object("@id" number,ename varchar2(100));
Please help to write SQL query
Select xmlement("employee",xmlforest()) from employees;