XMLATTRIBUTES
The XMLATTRIBUTES function constructs XML attributes from the arguments. This function can be used as an argument only for the XMLELEMENT function.
.-,--------------------------------------------------. V | >>-XMLATTRIBUTES(---attribute-value-expression--+--------------------+-+-)->< '-AS--attribute-name-'
The schema is SYSIBM.
The result is an XML sequence that contains an XQuery attribute node for each non-null attribute-value-expression argument.
- attribute-value-expression
- An expression that returns a value for the attribute. The data
type of attribute-value-expression must
not be ROWID, a LOB, a distinct type that is based on a ROWID or a
LOB, or XML.
The result of attribute-value-expression is mapped to an XML value according to the rules for mapping an SQL value to an XML value. If the expression is not a simple column reference, an attribute name must be specified.
- AS attribute-name
- Specifies an attribute name. The name is an SQL identifier that
must be in the form of an XML qualified name, or QName. If attribute-name is
a qualified name, the namespace prefix must be declared within the
scope of the qualified name.
attribute-name cannot be 'xmlns' or prefixed with 'xmlns:'. A namespace is declared using the function XMLNAMESPACES. The attribute names for an element must be unique for the XML element to be well-formed.
If attribute-name is not specified, the expression for attribute-value must be a column name. The attribute name will be created from the column name using the fully escaped mapping from a column name to an XML attribute name.
The result of the function is an XML value. The result can be null; if all attribute-value-expression arguments are null, the result is the null value.