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!

Creating table with json data

User_A8XLFFeb 4 2021 — edited Feb 4 2021

Hi ,
I am creating a SQL table with JSON data in it. I wote the following SQL script-:
CREATE TABLE json_documents (
id NUMBER,
data CLOB,
CONSTRAINT json_documents_pk PRIMARY KEY (id),
CONSTRAINT json_documents_json_chk CHECK (data IS JSON)
);
INSERT INTO json_documents (id, data)
VALUES (1, '{
“userId”:generic-employee@abc.com,
“priviliges”:[
{
“name”:"A",
“code”:"1",
},
{
“name”:"B",
“code”:"2",
},
{
“name”:"C",
“code”:"3",
},
{
“name”:"D",
“code”:"4",
},
{
“name”:"E",
“code”:"5",
},
{
“name”:"F",
“code”:”6”,
}
]
}');
COMMIT;
The issue is the table gets created but no data is inserted into it. When i run the select command it returns "No rows were selected". Please help.

This post has been answered by User_A8XLF on Feb 4 2021
Jump to Answer

Comments

Post Details

Added on Feb 4 2021
1 comment
220 views