PLSQL Block with dbms_lob.write command is getting failed with following error. Command: dbms_lob.write (tempblob,length(tempname), 1,utl_raw.cast_to_raw (substr(tempname,1,length(tempname))));
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 1124
ORA-06512: at line 12
The reason for this error is because you have used a blob column in the PLSQL block which is not initialized. Blob variable needs to be initialized before using the dbms_lob.write. EMPTY_BLOB and EMPTY_CLOB functions need to be used to initialize a LOB variable. These functions return an empty LOB locator. You can use an insert or update command to initialize a LOB column.
update BL_TEST set TR_PIC=empty_blob();