17.10 - Example: Using XMLSERIALIZE to Serialize an XML Value to a BLOB Value - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - XML Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1140-171K
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;