I’m trying to create a trigger which copies a blob from table B into the newly create row in table A. However, I get the error ORA-22275 (Invalid lob locator specified) when the trigger is supposed to be executed. I can imagine the way I access the blob of the new row is not the right way, could anyone point me in the right direction?
Code of the trigger:
CREATE OR REPLACE TRIGGER COPY_BLOB
BEFORE INSERT ON TABLE_A
FOR EACH ROW
DECLARE
src blob;
BEGIN
SELECT bytes INTO src FROM table_b WHERE id = :new.ref_id;
DBMS_LOB.COPY(:new.bytes, src, DBMS_LOB.GETLENGTH(src), 1, 1);
END;
/
your trigger should just be:
no need to use the DBMS_LOB package at all.