Oracle9i SQL Reference Release 1 (9.0.1) Part Number A90125-01 |
|
Functions, 124 of 166
sys_xmlagg::=
sys_xmlagg
The SYS_XMLAGG
function aggregates all of the XML documents or fragments represented by expr and produces a single XML document. It adds a new enclosing element with a default name ROWSET
. If you want to format the XML document differently, specify fmt, which is an instance of the SYS.XMLGenFormatType
object.
See Also:
|
The following example uses the SYS_XMLGEN
function to generate an XML document for each row of the sample table employees
where the employee's last name begins with the letter R, and then aggregates all of the rows into a single XML document in the default enclosing element ROWSET
:
SELECT SYS_XMLAGG(SYS_XMLGEN(last_name)).getClobVal() FROM employees WHERE last_name LIKE 'R%'; SYS_XMLAGG(SYS_XMLGEN(LAST_NAME)).GETCLOBVAL() --------------------------------------------------------------- <?xml version="1.0"?> <ROWSET> <LAST_NAME>Rajs</LAST_NAME> <LAST_NAME>Raphaely</LAST_NAME> <LAST_NAME>Rogers</LAST_NAME> <LAST_NAME>Russell</LAST_NAME> </ROWSET>
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|