I want to loop through a Json string to retrieve values. The following code gives me a JSON path expression error.
declare
buffer clob;
pos number;
Numb number;
begin
pos := 1;
buffer := '{"root":[{"theData":[224.08755140452405,124.08755140452405,324.08755140452405]}]}';
pos := 0;
EXECUTE IMMEDIATE 'select json_value(buffer,''$.root[0].theData[:pos]'') from dual'
using pos
returning INTO numb;
dbms_output.put_line(numb);
end;
If I replace the execute immediate command with the following statement
select json_value(buffer,'$.root[0].theData[0]') into numb from dual;
it works fine. Any ideas?
buffersupposed to be in the dynamic version? Did you mean to bind that and pass the real value viausingtoo? (Presumably you do actually have a reason to do this dynamically...?)