XMLSERIALIZE Function | XML Data Type | Teradata Vantage - XMLSERIALIZE - 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ā„¢

Serializes an XML value to its string representation.

Syntax

XMLSERIALIZE (
  { DOCUMENT | CONTENT } XML_value_expr
  [ AS data_type ]
  [ ENCODING XML_encoding_name ]
  [ WITH [NO] BOM ]
  [ VERSION 'char_str_literal' ]
  [ { INCLUDING | EXCLUDING } XMLDECLARATION ]
  [ NO INDENT | INDENT [ SIZE = integer ] ]
)
DOCUMENT
The XML value is an XML document node.
CONTENT
The XML value is an XQuery document node.
XML_value_expr
An instance of the XML type.
data_type
VARCHAR, CLOB, VARBYTE, or BLOB. If data_type is VARCHAR or CLOB, you can specify the character set as LATIN or UNICODE.
XML_encoding_name

An identifier for encodings such as ISO-8859-1 that are supported by Teradata Database.

You can specify the XML encoding specification only if the data type requested is VARBYTE or BLOB.

See Encoding Names Supported by Teradata XML.

WITH [ NO ] BOM

Whether or not a byte order mark should be added to the result.

The WITH BOM directive produces a byte order mark in these cases:
  • Target type is VARBYTE or BLOB and the encoding is a Unicode encoding (UTF-8, UTF-16, or UTF-32/UCS4)
  • Target type is VARCHAR or CLOB with the UNICODE CHARACTER SET and the client character set is UNICODE

In all other cases, the WITH BOM directive will not produce a byte order mark.

You should specify the WITH BOM option only with UNICODE client character sets.

VERSION 'char_str_literal'
The XML version to which the serialization conforms. Valid values:
  • '1.0'
  • '1.1'

If not specified or if an invalid value is specified, the default is '1.0'.

INCLUDING XMLDECLARATION or EXCLUDING XMLDECLARATION
Whether or not the XML declaration (<?xml..?>) occurs at the beginning of the serialization.
NO INDENT
Specifies no indentation.
INDENT [SIZE = integer]
Specifies indentation and the amount of indentation. The default size is 4.