Examples: Get the Storage Size Required for a Storage Format

Teradata Vantageā„¢ JSON Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1150-162K

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