SQL Language (MOSC)

MOSC Banner

json_table mishandles null-array

edited Jan 7, 2019 4:59AM in SQL Language (MOSC) 3 commentsAnswered ✓

I'm trying to understand why json arrays are handled differently when they are passed empty (brackets without content) than when they are passed as null, and wondered if anyone here has an explanation for it.

All json messages discussed below were parsed with the "json_table" function in an oracle 12.2.0.1.0 database.

The executed statement is the same for each json message:

select main_ordinality

     , sub_ordinality

     , main_id

     , sub_id

from   json_table( :b1, '$' error on error

                   columns ( nested path '$[*]' columns ( main_ordinality for ordinality

                                                        , main_id varchar2(1) path '$.main_id' null on empty

                                                        , nested path '$.subs[*]' columns ( sub_ordinality for ordinality

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

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

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center