Example: Using XMLSERIALIZE to Serialize an XML Value to a BLOB Value

Teradata Vantageā„¢ XML Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1140-162K

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;