XMLCONCAT accepts a list of XML value expressions as its arguments, and produces a forest of elements by concatenating the XML values that are returned from the same row to make one value. XMLCONCAT works like XMLFOREST, except that XMLCONCAT parameters is a list of XML elements. Null expressions are dropped from the result. If all the value expressions are null, then the function returns NULL.
The following example produces an XML elements for the 'FName', 'LName', 'country' and 'nationality', concatenates the result, and creates a one-column result set:
select XMLCONCAT ( XMLELEMENT ('FName', "FirstName"), XMLELEMENT ('LName', "LastName"), xquery_eval('//country', xtree_doc('<a><country>USA</country></a>')), xpath_eval('//nationality', xtree_doc('<a><nationality>RUSSIAN</nationality></a>'))) from "Demo"."demo"."Employees"; callret VARCHAR _______________________________________________________________________________ <FName>Nancy</FName><LName>Davolio</LName><country>USA</country><nationality>RUSSIAN</nationality> <FName>Andrew</FName><LName>Fuller</LName><country>USA</country><nationality>RUSSIAN</nationality> . . . <FName>Anne</FName><LName>Dodsworth</LName><country>USA</country><nationality>RUSSIAN</nationality> 9 Rows.