I searched a bit and I found some info on how to call java code from database trigger but none about the opposite. Isn't it possible to call a trigger from a java method? After inserting to one table (Table1), I need to create several rows to another table (Table2) from a select on the first one. I built the trigger but if I make it to execute after insert on the first table I get an error:
ORA-04091: table Table1 is mutating, trigger/function may not see it ORA-06512:....
I am working on an ADF application, and as Table1-Table2 have a master detail relationship, maybe it doesn't allow inserting rows this way. That is why I thought that calling the trigger through a button may solve my problem. Any idea?
Trigger:
CREATE OR REPLACE TRIGGER Table2
AFTER INSERT ON Table1 REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
insert into Table2
(
Select col1,col2... from Table1
);
END;