
The XMLCONCAT function returns a sequence containing the concatenation of a variable number of XML input arguments.
The result of the function is an XML sequence that contains the concatenation of the non-null input XML values. Null values in the input are ignored.
The result of the function is XML. The result can be null; if the result of every input value is null, the result is the null value.
SELECT XMLSERIALIZE( XMLCONCAT( XMLELEMENT(NAME "first", e.fname), XMLELEMENT(NAME "last", e.lname) )) AS "result" FROM EMPLOYEE EThe result of the query would look similar to the following result:
result ---------------------------------------- <first>John</first><last>Smith</last> <first>Mary</first><last>Smith</last>
SELECT XMLCONCAT( XMLCOMMENT ( 'Confirm these employees are on track for their product schedule'), XMLELEMENT( NAME "Department", XMLATTRIBUTES( E.WORKDEPT AS "name"), XMLAGG( XMLELEMENT(NAME "emp", E.FIRSTNME) ORDER BY E.FIRSTNME) )) FROM EMPLOYEE E WHERE E.WORKDEPT IN ('A00', 'B01') GROUP BY E.WORKDEPT
This query produces the following result:
<!--Confirm these employees are on track for their product schedule--> <Department name="A00"> <emp>CHRISTINE</emp> <emp>DIAN</emp> <emp>GREG</emp> <emp>SEAN</emp> <emp>VINCENZO</emp> </Department> <!--Confirm these employees are on track for their product schedule--> <Department name="B01"> <emp>MICHAEL</emp> </Department>
