A RAW
is limited to 2000 bytes. If your data is longer than that, you'll need to store it in a CLOB
and then convert the CLOB
to a BLOB
which is, unfortunately, a bit more complicated that the string_to_raw
function. Something like this will work assuming you can assign the entire string to a CLOB
variable which should work as long as the string is less than 32676 bytes in length. If it's longer than that, you'll need to write to the CLOB
in pieces and then convert to a BLOB
.
declare
l_blob blob;
l_clob clob := rpad('{"foo": {"id": "1", "value": "2", "name": "bob"}}',3200,'*');
l_amt integer := dbms_lob.lobmaxsize;
l_dest_offset integer := 1;
l_src_offset integer := 1;
l_csid integer := dbms_lob.default_csid;
l_ctx integer := dbms_lob.default_lang_ctx;
l_warn integer;
begin
dbms_lob.createTemporary( l_blob, false );
dbms_lob.convertToBlob( l_blob,
l_clob,
l_amt,
l_dest_offset,
l_src_offset,
l_csid,
l_ctx,
l_warn );
update json_data
set data = l_blob;
end;
/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…