Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Transform multiple json and result one

user13117585Feb 13 2024

Hello,

I have a question that looks easy but I can't find a solution. I wonder if anyone could help?

If I have two different json objects. they can contain as many key, values as possible (or even nested json objects).

WITH json1 AS (
  SELECT JSON_OBJECT('key1' : 'val1') AS j FROM dual
), json2 AS (
  SELECT JSON_OBJECT('key2' : 'val2') AS j FROM dual
)
SELECT *
  from json1, json2;

is it possible to have a concatenation of both json objects easilly? If I take this simple exemple, I would like to have this:


{
 'key1', 'val1', 
 'key2', 'val2'
}

I'm using Oracle 19c.

Comments
Post Details
Added on Feb 13 2024
4 comments
204 views