Skip to content
Advertisement

Compound trigger to insert into another table after insert or update into the main table

I’m working on a compound trigger and I’m having difficulties figuring out how to make it work. The trigger is on the person table. There is a column woman_act. If a new row is inserted and that column is not null than we need to insert that row into the v_changes table or if that column is updated from null to ‘X’ than insert that row into v_changes table. Going with COMPOUND trigger becuase I was getting mutating table and that was happening becuase I’m inserting from select.

Here is the logic

Here is my trigger. Any ideas and suggestions much appreciated.

Advertisement

Answer

There doesn’t appear to be a need to use a compound trigger here because there is no need to query the person table. Just use a row-level trigger and reference the :new and :old pseudorecords in your logic

Assuming you’re just learning PL/SQL, it may be easier to create some local variables and use those in your insert statement, i.e.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement