5-12. Creating a Trigger That Fires on Multiple Events


You have logic that is very similar for two different events. Thus, you want to combine that logic into a single trigger that fires for both. For example, let's assume that we want to create a single trigger on the EMPLOYEES table with code to fire after each row that is inserted or modified and also with code to fire at the end of each of those statements' executions.xs


Use a compound trigger to combine all the triggers into a single body of code. The trigger in this solution will execute based upon various timing points. It will execute AFTER EACH ROW in the EMPLOYEES table has been updated, as well as AFTER the entire update statement has been executed. The AFTER EACH ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.