I have a procedure like the following:
procedure receive_json(in_json in json) is
my_clob clob;
begin
-- This line keeps returning "wong number or types: to_clob"
in_json.to_clob(in_json, my_clob);
-- rest of my procedure
end receive_json;
How do I get the to_clob
method to actually put the JSON in my CLOB?
PL/JSON does not manage the CLOB for you. You have to do that yourself:
procedure receive_json(in_json in json) is
my_clob clob;
begin
dbms_lob.createtemporary(my_clob, true);
in_json.to_clob(my_clob, false, dbms_lob.lobmaxsize);
-- do something with my_clob
-- ...
-- ...
dbms_lob.freetemporary(my_clob);
end receive_json;
Note, also, that when calling to_clob
on an instance of JSON
it is not necessary to supply the instance as the first parameter.