Publishes one or more XML documents as a stream.
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 < and & is converted to &. 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.
- 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.
- 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
The XMLPUBLISH_STREAM stored procedure is created under the user TD_SYSXML.
- EXECUTE PROCEDURE on TD_SYSXML
- SELECT privilege on the staging table
- GRANT ALL (insert/update/delete/upsert) on the target tables
The result set is composed of a single column, XmlString, whose values need to be concatenated to create the XML document to be published.