Example: Error: JSON Dot Notation Reference With Multiple Results - 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ā„¢

This example shows a problematic JSON dot notation reference that finds multiple results and returns an error. If you want a list of values to be returned instead, you must specify this behavior using the SET SESSION DOT NOTATION...ON ERROR statement or the DotNotationOnErrorCondition DBS Control field.

Example

SELECT id, jsonCol.numbers
FROM test.jsonTable
WHERE id < 3
ORDER BY id;
Result:
*** Query completed. 2 rows found. 2 columns returned.  
*** Warning: 7548 More than one result per JSON instance found. 
*** Total elapsed time was 1 second.

id     jsonCol.numbers
------------------------
1      *** ERROR MULTI RESULT ***
2      ?                /* There are no numbers in this JSON */