Functional Description

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

The XMLPUBLISH_STREAM stored procedure publishes one or more XML documents as a stream. The entire document to be published is not materialized all at once. Instead, XMLPUBLISH_STREAM returns XML in chunks that will be concatenated on the client side to create well-formed XML document(s). This allows construction of large documents within memory constraints.

While processing a document, XMLPUBLISH_STREAM converts certain special characters to character entity references; for example, < is converted to &lt; and & is converted to &amp;. This is done to escape special characters in the data to ensure that well-formed XML is produced. An empty element is returned for an empty string and the element will be missing for a null string.

The stored procedure takes the following as input arguments:

  • An SQL query string
  • A mapping stylesheet that will transform the results of the SQL query to the desired XML structure.

    If you do not specify a mapping (you pass NULL as the Xslt argument), the procedure returns the canonical XML representation as output.

The procedure returns a result set composed of one column: XmlString. The client application concatenates the values in the XmlString column to create the XML document to be published.

If you specify documentGroupingSpec, XMLPUBLISH_STREAM allows the construction of multiple XML documents by grouping the query results based on documentGroupingSpec. The result set is interspersed with NULLs which mark the boundaries of the documents.

Recommendation: Use the XMLPUBLISH stored procedure instead of XMLPUBLISH_STREAM for these cases:

  • The size of the documents being published is small
  • The use of Teradata specific instructions, like teradata_group, is not required
  • You need to publish multiple documents