JSON Data Type | Declaration Syntax | Teradata Vantage - JSON Data Type 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ā„¢

The following shows the syntax when you use a JSON data type in a data type declaration phrase. For example, this syntax is used when defining a table column to be JSON type.

JSON [ (maxlength) ] [ INLINE LENGTH integer ]
  [ { CHARACTER SET { LATIN | UNICODE } |
    STORAGE FORMAT { BSON | UBJSON } }
  ]
  [ attribute [...] ]

Syntax Elements

maxlength
A positive integer value followed by an optional multiplier. maxlength specifies the maximum length of the JSON type as follows:
  • If the storage format of the JSON type is text, the maximum length is in characters. If you do not specify a maximum length, the default maximum length for the character set is used. If specified, the length is subject to a minimum of two characters and cannot be greater than the maximum of 16776192 LATIN characters or 8388096 UNICODE characters.
  • If the storage format is BSON or UBJSON, the maximum length is in bytes. If you do not specify a maximum length, the default maximum length of 16776192 bytes is used.
  • The multiplier, if specified, is KkMm.
The length specified only covers the actual data length. The actual storage sizes include additional header information.
INLINE LENGTH integer
A positive integer value which specifies the inline storage size. Data that is smaller than or equal to the inline storage size is stored inside the base row; otherwise, it is stored in a LOB subtable.
The inline length cannot be larger than maxlength.
CHARACTER SET
The character set for the JSON type can be LATIN or UNICODE.
If you do not specify a character set, the default character set for the user is used.
You cannot specify CHARACTER SET together with the STORAGE FORMAT clause.
STORAGE FORMAT
Specifies that the storage format of the JSON type will be one of the following binary formats:
  • BSON (Binary JSON)
  • UBJSON (Universal Binary JSON)
If you do not specify a storage format, the default storage format is text in the character set specified (or the default character set).
You cannot specify STORAGE FORMAT together with the CHARACTER SET clause.
attribute
The following data type attributes are supported for the JSON type:
  • NULL and NOT NULL
  • FORMAT
  • TITLE
  • NAMED
  • DEFAULT NULL
  • COMPRESS USING and DECOMPRESS USING
For details on these data type attributes, see Teradata Vantageā„¢ - Data Types and Literals, B035-1143.