I have a problem when trying to convert CLOB from a table to BLOB into another table.
Basically I'm looping inside a PLSQL array, the first call to DBMS_LOB.convertToBlob
always works well, but the next iterations either create an empty blob or give me an error ORA-22275: invalid LOB locator specified
, depending on whether I initialize my blob inside or outside the loop.
So, if I do :
BEGIN
FOR i IN 1 .. rs.COUNT
LOOP
DBMS_LOB.createTemporary (v_blob, TRUE);
DBMS_LOB.convertToBlob (v_blob,
rs (i).v_clob,
DBMS_LOB.LOBMAXSIZE,
v_in,
v_out,
DBMS_LOB.DEFAULT_CSID,
v_lang,
v_warning);
[...]
DBMS_LOB.freeTemporary(v_blob);
It converts the first blob well but only returns empty blobs for the other ones.
If I do:
BEGIN
DBMS_LOB.CREATETEMPORARY (v_blob, TRUE);
FOR i IN 1 .. rs.COUNT
LOOP
DBMS_LOB.convertToBlob(...);
It also converts the first blob well but I get the ORA-22275: invalid LOB locator specified
error after the first iteration.
How could I avoid this? I can't seem to find good explanation for this. Thanks for your help!