JSON_PUBLISH Table Operator Syntax | Teradata Vantage - JSON_PUBLISH Syntax - Advanced SQL Engine - Teradata Database

JSON Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
gzn1554761068186.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1150
lifecycle
previous
Product Category
Teradata Vantageā„¢

JSON_PUBLISH uses the standard table operator syntax. For details, see the table operator syntax described as part of the SELECT statement in Teradata Vantageā„¢ - SQL Data Manipulation Language.

Optional Custom Clauses

Two optional custom clauses are available to provide users with the flexibility needed to compose JSON data type instances in the exact format they desire:
DO_AGGREGATE
Causes the output instance(s) to be composed of one row of input data. This clause accepts either 'Y' or 'N' (not case specific) as follows:
  • 'Y' specifies that the result is aggregated. This is the default.
  • 'N' specifies that the result is not aggregated.

Excluding this clause causes JSON_PUBLISH to aggregate all data corresponding to a particular group (as defined in the optional GROUP BY clause in the SELECT statement of the ON clause) into one JSON data type instance. Note that the absence of this custom clause and of a GROUP BY clause causes all input rows to be grouped together in one resulting instance. If the result of aggregating the data into a JSON data type instance results in a size overflow based on the maximum size specified, an error accompanied by an appropriate error string is reported.

WRITE_ARRAY
Causes the output instance(s) to not be JSON arrays at the top level. Therefore, the default is to return a JSON array composed of one or more JSON documents which represent the published data. The only value accepted by this clause is the character 'N' (not case specific).

If you do not group the published data into a JSON array, but failure to do so would violate JSON syntax, an error accompanied by an appropriate error string is reported.