XMLFOREST function in PL/SQL

The XMLFOREST function allows you to read values from Oracle tables and present them in XML format. The general format for the XMLFOREST function is:

SELECT XMLFOREST(TABLE.field_name1, TABLE.field_name2, ...)
FROM TableName;

This function converts each of its argument parameters (field names from tables) to XML and returns an XML fragment that is a concatenation of each of the arguments (field names) converted to XML. The “alias” is a required part of the XMLFOREST function.


SELECT XMLFOREST(s.stno, s.sname) "Student name and number"
FROM Student s;


Student name and number

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.