is it possible to define the path expression in JSON_QUERY dynamically based on variables?
DECLARE
varpath varchar(180):= 'testvar1.testattribute';
BEGIN
SELECT (JSON_QUERY(json_field FORMAT JSON , '$.' || varpath RETURNING VARCHAR2(4000) ASIS WITHOUT ARRAY WRAPPER NULL ON ERROR)) FROM example1;
END;
The concatenation of '$.' || varpath leads to the error:
PL/SQL: ORA-40454: path expression not a literal.
Is there any way to achieve this? In my use case, I need to fetch the path dynamically from other tables, that's why I built this short test script.
Thanks in advance!