Setting Up the JSON_SHRED_BATCH JSONID and ROWINDEX Keyword Example

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

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

CREATE TABLE JSONDocs(
   JSONDocId INTEGER,
   jsnCol JSON(10000),
   site VARCHAR(200),
   country VARCHAR(200)
) UNIQUE PRIMARY INDEX (JSONDocId);

INSERT INTO JSONDocs VALUES('1', 
  NEW JSON('{"employees" : {"company" : "Teradata","info" : [ 
            {"id" : 1, "name" : "Cameron", "dept" : "engineering"},
            {"id" : 2, "name" : "Justin","dept" : "engineering"}
                    ]}}', LATIN),'HYD','USA');

INSERT INTO JSONDocs VALUES('2', 
  NEW JSON('{"employees" : {"company" : "Teradata","info" : [ 
            {"id" : 3, "name" : "Madhu", "dept" : "engineering"},
            {"id" : 4, "name" : "Srini","dept" : "engineering"}
                    ]}}', LATIN),'HYD','USA');

CREATE TABLE jsonshred.Teradata_Employees(
   rowIndex INTEGER, 
   empId INTEGER, 
   empName varchar(30), 
   company varchar(30),
   dept varchar(10), 
   jsonDocId INTEGER,
   site varchar(10), 
   country varchar(10));