.-CONTENT-. >>-XMLSERIALIZE--(--+---------+---------------------------------> >--XML-expression--AS--| data-type |----------------------------> .--------------------------------------. V .-VERSION--'1.0'---------------. (1) | >----+------------------------------+-----+--)----------------->< | .-EXCLUDING XMLDECLARATION-. | '-+-INCLUDING XMLDECLARATION-+-' data-type .-(1)-----------. |--+-+-CHARACTER-+--+---------------+--------------------------+--| | '-CHAR------' '-(--integer--)-' | +-+-VARCHAR----------------+--(--integer--)-----------------+ | '-+-CHARACTER-+--VARYING-' | | '-CHAR------' | | .-(1M)-----------------. | +-+-CLOB------------------------+--+----------------------+-+ | '-+-CHARACTER-+--LARGE OBJECT-' '-(--integer--+---+--)-' | | '-CHAR------' +-K-+ | | +-M-+ | | '-G-' | | .-(1M)-----------------. | '-+-BLOB-----------------+--+----------------------+--------' '-BINARY--LARGE OBJECT-' '-(--integer--+---+--)-' +-K-+ +-M-+ '-G-'
The schema is SYSIBM. The function name cannot be specified as a qualified name.
The XMLSERIALIZE function returns a serialized XML value of the specified data type generated from the XML-expression argument.
The result has the data type specified by the user. An XML sequence is effectively converted to have a single document node by applying XMLDOCUMENT to XML-expression prior to serializing the resulting XML nodes. If the result of XML-expression can be null, the result can be null; if the result of XML-expression is null, the result is the null value.
Therefore, applications should avoid direct use of XMLSERIALIZE INCLUDING XMLDECLARATION that return character string types and should retrieve XML values directly into host variables to maintain the match between the external code page and the encoding in the XML declaration. If XMLSERIALIZE must be used in this situation, a BLOB type should be specified to avoid code page conversion.