Load BLOB in to variable - "invalid LOB locator specified" exception
Hi
I need to load a BLOB file into a BLOB variable without returning a BLOB column from a table.
I was manage to do this with CLOB - I just set the CLOB variable to := ' ' and then load the CLOB from the file:
DECLARE
/*Populate BFiles to the LOB files*/
v_lob_file_0 BFILE := BFILENAME('MY_DIR', 'txt1.txt');
/*Declare LOB variables*/
v_COLUMN0 CLOB := ' ';
BEGIN
/*Get LOBs from file*/
DBMS_LOB.OPEN(v_lob_file_0, DBMS_LOB.LOB_READONLY);
DBMS_LOB.LoadFromFile(
DEST_LOB => v_COLUMN0
, SRC_LOB => v_lob_file_0
, AMOUNT => DBMS_LOB.GETLENGTH(v_lob_file_0));
DBMS_LOB.CLOSE(v_lob_file_0);
/*Update/Insert statment*/
INSERT INTO TBL1 VALUES (
1,
v_COLUMN0);
COMMIT;
END;
I try to set the BLOB variable to EMPTY_BLOB but I still get the exception:
ORA-22275: invalid LOB locator specified
ORA-06512: at "SYS.DBMS_LOB", line 637
ORA-06512: at line 35
22275. 00000 - "invalid LOB locator specified"
*Cause: There are several causes
initialized; (2) the locator is for a BFILE and the routine
expects a BLOB/CLOB/NCLOB locator; (3) the locator is for a
BLOB/CLOB/NCLOB and the routine expects a BFILE locator;
(4) trying to update the LOB in a trigger body -- LOBs in
trigger bodies are read only; (5) the locator is for a
BFILE/BLOB and the routine expects a CLOB/NCLOB locator;
(6) the locator is for a CLOB/NCLOB and the routine expects
a BFILE/BLOB locator;
*Action: For (1), initialize the LOB locator by selecting into the locator
variable or by setting the LOB locator to empty. For (2),(3),
(5) and (6)pass the correct type of locator into the routine.
For (4), remove the trigger body code that updates the LOB value.
thanks