Determining the Maximum Length for a Binary-formatted JSON Column - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

The length specified for a JSON column that uses a binary format must be large enough to fit the length of the data in its binary format. However, when retrieving the data, the data is converted to its text equivalent. For the binary formats, strings are stored in UTF8, and the data is converted to UNICODE when retrieved.

If the length is not large enough for the text representation of the data, you can store the data in the binary format, but you cannot retrieve the binary data as text format. An error is reported if you try to select the data without casting to a larger size. Therefore, determining an appropriate length for the column requires planning. The following example shows a way to determine this length.