I wrote a PL/SQL Code which requests a Dremio Service and receives JSON with database output. The output is saved to a REST_COLLECTION clob. The output will be shown in an APEX-Page. The problem with this Dremio service is, that I can only receive 500 datas at once. The solution was a loop and a concatination of the results each time..... Thats the problem I have.
The JSON looks like this:
{"rowCount":307,"schema":[{"name":"EXPORTDATUM","type":{"name":"DATE"}},
{"name":"DOKUMENTE","type":{"name":"DOUBLE"}},{"name":"SEITEN","type":{"name":"DOUBLE"}},
{"name":"STAPELKLASSE","type":{"name":"VARCHAR"}},{"name":"FORMULAR","type"
{"name":"VARCHAR"}}],"rows":[{"EXPORTDATUM":"2019-02-04","DOKUMENTE":9.0,"SEITEN":37.0,"STAPELKLASSE":"TEST","FORMULAR":"TEST"}]}
Concat the JSON strings each time leads to a JSON error at the Page view, because of multiple root elements.
SUBSTR given strings is not a commom way, Dremio outpup could may change.
Creating multiple clobs each time is possible, but my query then dont know the amount of clobs. Query looks like this btw:
select
to_date(j."EXPORTDATUM", 'YYYY-MM-DD') as "EXPORTDATUM",
j."DOKUMENTE",
j."SEITEN",
j."STAPELKLASSE",
j."FORMULAR"
from apex_collections c, json_table(
c.clob001 format json,
'$.rows[*]'
columns (
"EXPORTDATUM" VARCHAR2(4000) path '$.EXPORTDATUM',
"DOKUMENTE" VARCHAR2(4000) path '$.DOKUMENTE',
"SEITEN" VARCHAR2(4000) path '$.SEITEN',
"STAPELKLASSE" VARCHAR2(4000) path '$.STAPELKLASSE',
"FORMULAR" VARCHAR2(4000) path '$.FORMULAR'
)
) j
where c.collection_name = 'REST_COLLECTION'
I hope there is a solution for concat multiple JSONs without substring it.