Example: Error: JSON Dot Notation Reference with Multiple Results - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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.

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 */