15.10 - Examples: Get the Storage Size Required for a Storage Format - Teradata Database

Teradata Database Teradata JSON

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
TeradataJSON_15_10.ditamap
dita:ditavalPath
ft:empty

Example: StorageSize with No Storage Format Specified

This example calls StorageSize with no storage format specified. The method defaults to using the storage format of the input data, which is LATIN text in this case.

SELECT NEW JSON('{"hello":"world"}').StorageSize() 
FROM jsonTable;

Result:

NEW JSON('{"hello":"world"}').StorageSize()
-------------------------------------------
                                         17 

Example: StorageSize with UNICODE Text Storage Format Specified

This example gets the number of bytes needed to store the LATIN text JSON input in UNICODE text format.

SELECT NEW JSON('{"hello":"world"}').StorageSize('UNICODE_TEXT') 
FROM jsonTable;

Result:

NEW JSON('{"hello":"world"}').StorageSize('UNICODE_TEXT')
---------------------------------------------------------
                                                       34 

Example: StorageSize with BSON Storage Format Specified

This example gets the number of bytes needed to store the LATIN text JSON input in BSON format.

SELECT NEW JSON('{"hello":"world"}').StorageSize('BSON') 
FROM jsonTable;

Result:

NEW JSON('{"hello":"world"}').StorageSize('BSON')
-------------------------------------------------
                                               22 

Example: StorageSize with UBJSON Storage Format Specified

This example gets the number of bytes needed to store the LATIN text JSON input in UBJSON format.

SELECT NEW JSON('{"hello":"world"}').StorageSize('UBJSON') 
FROM jsonTable;

Result:

NEW JSON('{"hello":"world"}').StorageSize('UBJSON')
---------------------------------------------------
                                                 23