Skip to content
Advertisement

jOOQ JSON query results in ORA-00979

I’m trying to execute this query to an Oracle 19c database:

JavaScript

But I get

JavaScript

Does jOOQs JSON feature not work with Oracle?

Advertisement

Answer

This isn’t related to your JSON usage. The same thing would have happened if you removed all of it and wrote this query instead:

JavaScript

Your query would work in MySQL, PostgreSQL or standard SQL, where you can still project all functionally dependent columns after grouping by a primary key column. But in Oracle, this doesn’t work. So, you have to add EMPLOYEE.NAME to your GROUP BY clause.

There’s a feature request to transform your SQL accordingly, but jOOQ 3.14 does not support this yet: https://github.com/jOOQ/jOOQ/issues/4725

Note that JSON_ARRAYAGG() aggregates empty sets into NULL, not into an empty []. If that’s a problem, use COALESCE()

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