ARRAY_TO_JSON JSON Function Syntax | Teradata Vantage - ARRAY_TO_JSON 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ā„¢
{ [TD_SYSFNLIB.] ARRAY_TO_JSON (ARRAY_expr) |

  ( [TD_SYSFNLIB.] ARRAY_TO_JSON (ARRAY_expr) RETURNS returns_clause )
}

Syntax Elements

returns_clause
{ data_type [ ( integer ) ] [ CHARACTER SET { UNICODE | LATIN } ] |

  STYLE column_expr
}
You can use the RETURNS clause to specify the maximum length and character set of the JSON type.
If you do not specify a RETURNS clause, the return type defaults to JSON data type with UNICODE character set and a return value length of 64000 bytes, which supports up to 32000 UNICODE characters.
TD_SYSFNLIB
The name of the database where the function is located.
ARRAY_expr
An expression that evaluates to an ARRAY data type.
ARRAY_expr specifies the array to be converted to the JSON type.
RETURNS data_type
Specifies that data_type is the return type of the function.
data_type can only be JSON.
integer
A positive integer value that specifies the maximum length in characters of the JSON type.
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.
CHARACTER SET
The character set for the return value of the function, which can be LATIN or UNICODE.
If you do not specify a character set, the default character set for the user is used.
RETURNS STYLE column_expr
Specifies that the return type of the function is the same as the data type of the specified column. The data type of the column must be JSON.
column_expr can be any valid table or view column reference.