XMLCONCAT
The XMLCONCAT function returns an XML sequence that contains the concatenation of a variable number of XML input arguments.
.-,------------------. V | >>-XMLCONCAT(XML-expression---+----------------+-+-)----------->< '-XML-expression-'
The schema is SYSIBM.
- XML-expression
- An expression that returns an XML value.
The data type of the result is XML. 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 can be null; if the result of every input value is null, the result is the null value.
Example: Concatenate first
name and last name elements by using 'first' and 'last' element names
for each employee.
SELECT XMLSERIALIZE( XMLCONCAT
( XMLELEMENT ( NAME "first", e.fname),
XMLELEMENT ( NAME "last", e.lname)
) ) AS "result"
FROM employees e;
The result of the query would
look similar to the following result:
result
---------------------------------------------
<first>John</first><last>Smith</last>
<first>Mary</first><last>Smith</last>