Setting Up the ARRAY_TO_JSON Examples

Teradata Vantageā„¢ JSON Data Type

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

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)