I have a table with a CLOB that stores a big JSON payload. I cannot however select certain attributes whose value is greater than 4000 bytes.
For example, take a json like this:
{
"foo": "some string smaller than 4k",
"bar": "some string larger than 4k"
}
The following works:
SELECT json_value(j, '$.foo' ERROR ON ERROR) FROM j;
The following fails with ORA-40478: output value too large (maximum:):
SELECT json_value(j, '$.bar' ERROR ON ERROR) FROM j;
From this 12CR1 documentation:
ORA-40478: output value too large (maximum: string)
Cause: The provided JavaScript Object Notation (JSON) operator generated a result which exceeds the maximum length specified in the RETURN clause.
Action: Increase the maximum size of the data type in the RETURNING clause or use a CLOB or BLOB in the RETURNING clause.
However, using the RETURNING clause fails as well, with ORA-40444: JSON processing error:
SELECT json_value(j, '$.bar' RETURNING CLOB ERROR ON ERROR) FROM j;
It also fails during PLSQL
DECLARE
val CLOB;
BEGIN
SELECT json_value(j, '$.bar' RETURNING CLOB ERROR ON ERROR)
INTO val
FROM j
END;