Previous Topic: XMLSERIALIZENext Topic: Predicates


XMLCONCAT

This function returns an XML value that is the concatenation of a list of XML values.

Following is the syntax diagram for XMLCONCAT:

                   ┌─ , ────────────────────┐
├── XMLCONCAT ─ ( ─▼─ xml-value-expression ─┴─ ) ──────────────────────────────┤
xml-value-expression

Any expression whose result is an XML value, such as XMLELEMENT (see XMLELEMENT), XMLCONCAT (see XMLCONCAT), or XMLFOREST (see XMLFOREST).

The following example (a repetition of the XMLELEMENT example) produces a Customer element for each customer, with customer number and name attributes:

SELECT XMLSERIALIZE(CONTENT
                    XMLCONCAT(XMLELEMENT(NAME "contact',v.contactName),
                              XMLELEMENT(NAME "phone",v.contactPhone)
                             )
                    AS VARCHAR(300)) AS "vendorContacts"
  FROM vendors v;

The result of the previous example follows:

vendorContacts
VARCHAR(300)
------------------------------------------------------------
<-contact>Joeseph Dudely<-/contact><-phone>123-456-7890<-/phone>
<-contact>Mary Doeright<-/contact><-phone>123-456-1313<-/phone>
------------------------------------------------------------