Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

JSON_OBJECT SYNTAX questions in version 19C and later

inho kimFeb 22 2024 — edited Feb 22 2024

First of all, let me apologise for my poor English.

If you look at the first of the attached images above, it says that you can create a JSON_OBJECT using the syntax in the form of JSON{KEY:VALUE}.

However, if you look at the second image, "Description of json_object", you will notice that the "|" mark is placed in front of { JSON_OBJECT_CONTENT }, except for the JSON keyword.

This is to indicate that you can create a JSON_OBJECT using only { JSON_OBJECT_content }.

However, when you actually run it, you'll find that the JSON{KEY:VALUE} form works fine, but using only {KEY:VALUE} will cause an error.
Example: SELECT JSON{KEY:VALUE} FROM DUAL (success)
Example. SELECT {KEY:VALUE} FROM DUAL (error)

Why is it that the official documentation still doesn't show this correctly after so much time has passed since 19c to 23c?

Also, the syntax is mentioned in the SQL Language Reference, but not in the
JSON Developer's Guide, etc.
(https://docs.oracle.com/en/database/oracle/oracle-database/19/adjsn/generation.html#GUID-6C3441E8-4F02-4E95-969C-BBCA6BDBBD9A)

When I first started studying Oracle syntax, I tried running it in Oracle Live SQL to check the above syntax, but it didn't work because it was in 19.17. So I tried to find out in which version 19c was introduced, but even after checking all the release notes, there is no mention of it being added.

In conclusion, I feel that Oracle's official documentation is not friendly.

This post has been answered by mathguy on Feb 22 2024
Jump to Answer
Comments
Post Details
Added on Feb 22 2024
5 comments
180 views