Description
The specified expression value is returned enclosed by a start tag and an end tag, as shown in the following format:
<tag>value</tag>
Commonly, expression is the name of a column, or an expression containing one or more column names. XMLFOREST tags each expression as follows:
- If AS
tag is omitted, andexpression is a column name,XMLFOREST tags the resulting values with the column name. Column name default tags are always uppercase. - If AS
tag is omitted, andexpression is not a column name (for example, an aggregate function, a literal, or a concatenation of two columns)XMLFOREST tags the resulting values with a blank tag. For example: <>literal string</>
The XMLFOREST function only returns a tag for actual data values. It does not return a tag when the expression value is NULL. The empty string ('') is considered a data value. If the value to be tagged is the empty string (''), XMLFOREST returns:
<tag></tag>
If a data value contains a punctuation character that XML/HTML might interpret as a tag or other coding, XMLFOREST and XMLELEMENT convert this character to the corresponding encoded form:
To represent an apostrophe in a supplied text string, specify two apostrophes, as in the following example: 'can''t' . Doubling apostrophes is not necessary for column data.
The following query returns the Name column values in Sample.Person as ordinary data and as xml tagged data:
A sample row of the data returned would appear as follows. Here the tag defaults to the name of the column:
SELECT XMLFOREST(Home_City, Home_State AS Home_State, AVG(Age) AS AvAge) AS ExportData FROM Sample.Person
The Home_City field specifies no tag; the tag is generated from the column name in all capital letters: <HOME_CITY>. The Home_State field's AS clause is optional. It is specified here because specifying the tag name allows you to control the case of the tag: <Home_State>, rather than <HOME_STATE>. The AVG(Age) AS clause is mandatory, because the value is an aggregate, not a column value, and thus has no column name. A sample row of the data returned would appear as follows.
wonderful information, I had come to know about your blog from my friend nandu , hyderaba.i have read atleast 7 posts of yours by now, and let me tell you, your website gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts.
ReplyDeleteOracle Fusion HCM Training