I have the following json:
{
"title": "title",
"description": "description",
"references": [{
"reference_id": 181
},
{
"reference_id": 182
}]
}
I want to insert the data of references array in a table xyz which contains the following columns: buffer_id and reference_id
INSERT INTO xyz (
buffer_id,
reference_id
)
SELECT
l_buffer_id,
reference_id
FROM
dual,
JSON_TABLE ( data, '$.references[*]'
COLUMNS (
l_buffer_id ,
reference_id NUMBER PATH '$.reference_id'
)
);
Here, l_buffer_id is a variable where my value is stored. I tried the above method to insert data into xyz. However it is not working. Is there any way to get this to work?