Open AnghelLeonard opened 3 years ago
Thanks a lot for your suggestion. I think that's what Oracle and the standard (which was mostly written by Oracle) refer to as the FORMAT JSON
syntax, which is occasionally generated by jOOQ internally when needed.
See their example from the docs: https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/JSON_TABLE.html#GUID-3C8E63B5-0B94-4E86-A2D3-3D4831B67C62
SELECT *
FROM JSON_TABLE('[1,2,["a","b"]]', '$'
COLUMNS (outer_value_0 NUMBER PATH '$[0]',
outer_value_1 NUMBER PATH '$[1]',
outer_value_2 VARCHAR2(20) FORMAT JSON PATH '$[2]'));
Result:
OUTER_VALUE_0 OUTER_VALUE_1 OUTER_VALUE_2
------------- ------------- --------------------
1 2 ["a","b"]
Can you confirm this is the same idea as what you had in mind?
Yes, that's the idea.
Thanks for the feedback. Sure, that would be a very valuable addition. Should be doable for jOOQ 3.15
Related issue: https://github.com/jOOQ/jOOQ/issues/12080
Use case:
Let's consider a JSON snippet in a table named
MANAGER
(column,MANAGER_DETAIL
):And, the following jOOQ code:
The generated SQL produced
NULL
forphoneNumber
.Possible solution you'd like to see:
In place of
NULL
, an output as:[{"type":"home","number":["212 555-1234","212 543-0933"]}]
.Please describe a possible solution you'd like to see in jOOQ, ideally with example code.
The generated SQL:
to become:
So, in jOOQ, probably, something as:
Versions: