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.