Objective : Generate XML data from relational data using oracle provided standard packages. Prerequisite : DBMS_XMLGEN.GETXML ( sqlQuery IN VARCHAR2, dtdOrSchema IN number := NONE) return clob; Converts the results from the SQL query string to XML format, and returns the XML as a temporary CLOB. Solution: SELECT dbms_xmlgen.getxml('select * from emp') xml FROM dual; This query will give you the complete XML structure output of the table along with its data. Output: Related Posts: Print CLOB data using Oracle PL/SQL
by Karkuvelraja Thangamariappan ♠ (@tkarkuvelraja)