XML from Data Base Examples
SX-H-1 Making a Forest of XML elements by XMLAGG() function
XMLAGG() function
XMLAGG() function. Overview
XMLAGG is aggregate function that produces a forest of XML elements from the given list of xml elements. It concatenates the values returned from one column of multiple rows, unlike XMLCONCAT, which concatenates the values returned from multiple columns in the same row.
Example 1
This example produces a forest of all 'Name' of the employees having the title 'Sales Representative' and places it into one top-level element:
select XMLELEMENT ('SalesRepresentatives',
XMLAGG (XMLELEMENT ('Name', "FirstName", ' ', "LastName")) )
from "Demo"."demo"."Employees"
where "Title"='Sales Representative';
| View the source | Action |
|---|---|
| 1. sx_h_1_sample.vsp | Run |
OpenLink Home
Technical Support