16.20 - Example: Using XMLSERIALIZE to Serialize an XML Value to a BLOB Value - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ XML Data Type

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1140-162K
Language
English (United States)

When serializing to BLOB or VARBYTE, you can specify the desired encoding for the serialization. If any of the data in the document cannot be represented in the specified encoding, a character translation error will occur.

SELECT XMLSERIALIZE(DOCUMENT customerXML AS BLOB ENCODING "UTF-8"
   WITH BOM INCLUDING XMLDECLARATION)
FROM customer
WHERE customerID = 1;