scenario: when the business level deletes (physically deletes) a piece of data from Table A, the data is inserted into Table B.
set up a trigger on table A
CREATE OR REPLACE TRIGGER cmsinfo
AFTER delete
ON tablea
for each row
BEGIN
IF DELETING THEN
INSERT INTO tableb values(:old.id);
end if;
END cmsinfo ;
if deletion is performed, an ORA-04091 error will be reported
ORA-04091: tablea , /
looked for something on the network that said it was autonomous. After modifying the trigger as follows, it still reported an error
.CREATE OR REPLACE TRIGGER cmsinfo
AFTER delete
ON tablea
for each row
declare
pragma autonomous_transaction;
BEGIN
IF DELETING THEN
INSERT INTO tableb values(:old.id);
COMMIT;
end if;
END cmsinfo ;
an error is reported after performing the deletion
nested exception is java.sql.SQLException: ORA-00060:
how to accomplish this requirement (when deleting (physically deleting) a piece of data from Table A, inserting that piece of data into Table B without modifying the code.
because the project is not our own difficult modification, we want to implement it from the database level.