Contents Index Using the XMLAGG function Using the XMLELEMENT function

ASA SQL User's Guide
  Using XML in the Database
    Using SQL/XML to obtain query results as XML

Using the XMLCONCAT function


The XMLCONCAT function creates a forest of XML elements by concatenating all the XML values passed in. For example, the following query concatenates the <first_name> and <last_name> elements for each employee in the employee table:

SELECT XMLCONCAT( XMLELEMENT( NAME first_name, emp_fname ),
                  XMLELEMENT( NAME last_name, emp_lname )
                 ) AS "Employee_Name"
FROM employee

This query returns the following result:

Employee_Name
<first_name>Fran</first_name>
<last_name>Whitney</last_name>
<first_name>Matthew</first_name>
<last_name>Cobb</last_name>
<first_name>Philip</first_name>
<last_name>Chin</last_name>
<first_name>Julie</first_name>
<last_name>Jordan</last_name>
...

For more information, see XMLCONCAT function [String].


Contents Index Using the XMLAGG function Using the XMLELEMENT function