I am trying to create a trigger that on INSERT or UPDATE of a record where the TESTGROUP == 'HSSAG' that a duplicate of that record would be created for the TESTGROUP 'HSBEJ' ..... and when a record for HSSAG was updated, the associated HSBEJ record would then be updated.
create or replace TRIGGER VAL_TESTTYPE_CLONING
AFTER DELETE OR INSERT OR UPDATE OF TESTGROUP ON CLONING_TABLE
FOR EACH ROW
WHEN (new.TESTGROUP = 'HSSAG')
BEGIN
INSERT INTO CLONING_TABLE (TESTCOL, TESTGROUP) VALUES(:new.TESTCOL, 'HSBEJ');
END;
This is the error i get when i try to insert
INSERT INTO "CLMSDBA"."CLONING_TABLE" (TESTCOL, TESTGROUP) VALUES ('3', 'HSSAG')
ORA-04091: table CLMSDBA.CLONING_TABLE is mutating, trigger/function may not see it
ORA-06512: at "CLMSDBA.VAL_TESTTYPE_CLONING", line 2
ORA-04088: error during execution of trigger 'CLMSDBA.VAL_TESTTYPE_CLONING'
ORA-06512: at line 1
One error saving changes to table "CLMSDBA"."CLONING_TABLE":
Row 3: ORA-04091: table CLMSDBA.CLONING_TABLE is mutating, trigger/function may not see it
ORA-06512: at "CLMSDBA.VAL_TESTTYPE_CLONING", line 2
ORA-04088: error during execution of trigger 'CLMSDBA.VAL_TESTTYPE_CLONING'
ORA-06512: at line 1