Skip to content
Advertisement

Oracle bug when using JSON_ARRAYAGG with CASE expression to emulate standard SQL FILTER

I’m using Oracle 18c (reproduces in 19c as well) and I’d like to emulate the standard SQL FILTER clause in the JSON_ARRAYAGG() aggregate function to filter out values from the aggregation. However, this produces an error:

The error being:

ORA-40590: invalid format

dbfiddle here. What’s causing the error? Is it a bug in Oracle?

Advertisement

Answer

It does seem to be a bug, which has been fixed already in 19.10. Adding an explicit ELSE clause seems to resolve the issue:

This now produces the expected result:

dbfiddle here.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement