How to return two or more column values originating from an inner array?
I have a table that has a CLOB JSON column with a compressed JSON. Inside this JSON, I have two XML, as below:
{
"type": "com.xpto.abc.impl.JobResponse",
"data": {"responses": {"666a3c3f-666-45cb-aa50-666930b42fd7": ["XML1", "XML2"]}}
}
Using SQL, how I can get the XML1 and XML2? I tried to use the below query. It is working fine to retrieve the nodes "type" and "data", but does not work to iterate into XML1 and XML2.
select tipo,
seq,
response
from response r,
json_table(r.payload, '$'
columns tipo VARCHAR2(64) PATH '$.type',
responses varchar2 FORMAT JSON PATH '$.data.responses[*]',
NESTED PATH '$[*]'
COLUMNS (seq FOR ORDINALITY,
response VARCHAR2 FORMAT JSON PATH '$'));
I want the following query return:
| TIPO | SEQ | RESPONSE |
|---|---|---|
| com.xpto.abc.impl.JobResponse | 1 | XML1 |
| com.xpto.abc.impl.JobResponse | 2 | XML2 |
from Recent Questions - Stack Overflow https://ift.tt/2UQYlDw
https://ift.tt/eA8V8J
Comments
Post a Comment