Contents Index XMLELEMENT function [String] XMLGEN function [String]

ASA SQL Reference
  SQL Functions
    Alphabetical list of functions

XMLFOREST function [String]


Function 

Generates a forest of XML elements.

Syntax 

XMLFOREST ( element-content-expression [ AS element-name ],... )

Parameters 

element-content-expression    A string. An element is generated for each element-content-expression argument that is specified. The element-content-expression value becomes the content of the element. For example, if you specify the emp_id column from the employee table for this argument, then an <emp_id> element containing an emp_id value is generated for each value in the table.

Specify the element-name argument if you wish to assign a name other than the element-content-expression to the element, otherwise the element name defaults to the element-content-expression name.

Usage 

Produces a forest of XML elements. In the unparsed XML document, a forest refers to the multiple root nodes within the document. When all of the arguments to XMLFOREST are NULL, a NULL value is returned. If only some values are NULL, the NULL values are omitted from the result. Element content is always quoted unless the data type is XML. You cannot specify attributes using XMLFOREST. Use the XMLELEMENT function if you wish to specify attributes for generated elements.

For more information about the XMLELEMENT function, see XMLELEMENT function [String].

Element names are quoted unless the data type is XML.

If you require a well-formed XML document, you must ensure that your query is written so that a single root element is generated.

Data in BINARY, LONG BINARY, IMAGE, and VARBINARY columns is automatically returned in base64-encoded format when you execute a query that contains XMLFOREST.

Standards and compatibility 
See also 

Using the XMLFOREST function

XMLELEMENT function [String]

XMLCONCAT function [String]

Example 

The following statement produces an XML element for the first and last name of each employee.

SELECT emp_id,
       XMLFOREST( emp_fname, emp_lname
                ) AS "Employee Name"
FROM employee

Contents Index XMLELEMENT function [String] XMLGEN function [String]