w3resource

Oracle PL/SQL Trigger: A Comprehensive Guide

PL/SQL Trigger [ 11 exercises with solution ]

1. Write a code in PL/SQL TO create a trigger that automatically updates a 'last_modified' timestamp whenever a row in a specific table is updated.

Click me to see the solution

2. Write a code in PL/SQL to create a trigger that prevents updates on a certain column during specific hours of the day.

Click me to see the solution

3. Write a code in PL/SQL to implement a trigger that maintains a transaction history log whenever a row is deleted from a table.

Click me to see the solution

4. Write a code in PL/SQL to develop a trigger that enforces referential integrity by preventing the deletion of a parent record if child records exist.

Click me to see the solution

5. Write a code in PL/SQL to create a trigger that checks for duplicate values in a specific column and raises an exception if found.

Click me to see the solution

6. Write a code in PL/SQL to create a trigger that restricts the insertion of new rows if the total of a column's values exceeds a certain threshold.

Click me to see the solution

7. Write a code in PL/SQL to design a trigger that captures changes made to specific columns and logs them in an audit table.

Click me to see the solution

8. Write a code in PL/SQL to implement a trigger that records user activity (inserts, updates, deletes) in an audit log for a given set of tables.

Click me to see the solution

9. Write a code in PL/SQL to implement a trigger that automatically calculates and updates a running total column for a table whenever new rows are inserted.

Click me to see the solution

10. Write a code in PL/SQL to create a trigger that validates the availability of items before allowing an order to be placed, considering stock levels and pending orders.

Click me to see the solution

11. Design a trigger that sends an email notification to a predefined address whenever an error occurs during a specific operation.

Click me to see the solution



Follow us on Facebook and Twitter for latest update.