Wrong Results on JSON Query.

(Doc ID 2301973.1)

Last updated on OCTOBER 30, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 12.1.0.2 and later
Information in this document applies to any platform.

Symptoms

A JSON Query is giving wrong results.

Actaul Output:
============
SQL> SELECT jt.* FROM dac_t, JSON_TABLE(jdoc, '$' COLUMNS ("a" VARCHAR2(5) PATH '$.a', NESTED PATH '$.b[*]' COLUMNS ("c" VARCHAR2(5) PATH '$.c',"seq" FOR ORDINALITY, NESTED PATH '$.d[*]' COLUMNS ("d" NUMBER PATH '$')))) jt;

A C SEQ D
----- ----- ---------- ----------
a1 c1 1 1
a1 c1 2 2
a2 c2 1 3
a2 c2 2 4

Expected Output:
===============

SQL> SELECT jt.* FROM dac_t, JSON_TABLE(jdoc, '$' COLUMNS ("a" VARCHAR2(5) PATH '$.a', NESTED PATH '$.b[*]' COLUMNS ("c" VARCHAR2(5) PATH '$.c',"seq" FOR ORDINALITY, NESTED PATH '$.d[*]' COLUMNS ("d" NUMBER PATH '$')))) jt;
A C SEQ D
----- ----- ---------- ----------
a1 c1 1 1
a1 c1 1 2
a2 c2 1 3
a2 c2 2 4

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms