15.10 - Setting Up the ARRAY_TO_JSON Examples - 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

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)