ARRAY_TO_JSON Function Examples | Teradata Vantage - Setting Up the ARRAY_TO_JSON Examples - 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ā„¢

Create and populate table(s) to use in subsequent example(s).

The user must have permission to CREATE TYPE. For example, GRANT UDTTYPE on sysudtlib to <userID> WITH GRANT OPTION;
CREATE TYPE intarr5 AS INTEGER ARRAY[5];
CREATE TYPE intarr33 AS INTEGER ARRAY[3][3];
CREATE TYPE varchararr5 AS VARCHAR(50) ARRAY[5];

CREATE TABLE arrayTable (id INTEGER, a intarr5, b intarr33);
INSERT INTO arrayTable(1, new intarr5(1,2,3,4,5), 
                       new intarr33(1,2,3,4,5,6,7,8,9));
To show the contents of arrayTable, run: SELECT * FROM arrayTable;
id	 a              b
-------------------------------------------                
1 	(1,2,3,4,5)	(1,2,3,4,5,6,7,8,9)