Teradata provides shredding functionality that allows you to extract values from JSON documents and store the extracted data in relational format. Data from a JSON instance can be used to INSERT, UPDATE, UPSERT, or DELETE from one or more existing tables.
For simple cases of shredding JSON data, you can use the INSERT...JSON statement. This statement only supports shredding JSON documents stored in text format.
For more complex cases of shredding JSON data, you can use the following table operator and stored procedures:
- This is a table operator which takes a JSON instance and creates a temporary table based on a subset, or all, of the data contained in the JSON instance.
- JSON_SHRED_BATCH and JSON_SHRED_BATCH_U
- The JSON_SHRED_BATCH and JSON_SHRED_BATCH_U stored procedures load relational tables with data extracted from JSON instances.
- JSON_SHRED_BATCH operates on LATIN character set data and JSON_SHRED_BATCH_U operates on UNICODE data. Otherwise, the two procedures are the same.
The table operator and stored procedures operate on JSON documents stored in text format as well as the binary formats.