I am trying to parse large json data from a api using JSON_TABLE and store it in a table. Every time when I am parsing this json data, result is in-consistent.
Ex: Suppose if the api response has 4000 json key-value pairs and If i am trying to parse response using JSON_TABLE and store them in a table ,then count of items from the query is not consistent.
i.e For the first time it shows count as 4000 which is correct and when i execute same api response for the next time ,the count some times shows as 1055,1099 which is odd.
ORACLE VERSION: 19.10.0.0
NOTE: Whenever I used error on error for Json_table ,it throws an exception as below
“40441. 00000 - "JSON syntax error"
*Cause: The provided JavaScript Object Notation (JSON) data had invalid
syntax and could not be parsed.
*Action: Provide JSON data with the correct syntax.”
CODE:
INSERT INTO “TABLE_NAME” VALUES
SELECT
col1,col2,col3
FROM
JSON\_TABLE ( json\_result, '$.data\[\*\]'
COLUMNS (
col1 VARCHAR2 ( 1000 CHAR) PATH '$.fields.poNumber',
col2 VARCHAR2 ( 1000 CHAR) PATH '$.fields.varchar2',
col3 NUMBER FORMAT JSON PATH '$.fields.num'
)
);