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

XML Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
amr1556233250442.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1140
lifecycle
previous
Product Category
Teradata Vantage™

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;