The document explains database triggers, which are special stored procedures that execute automatically in response to events on a table or view. It highlights key differences between triggers and stored procedures, such as the inability to manually invoke triggers or pass parameters. Two specific triggers are detailed: one for inserting records before a faculty entry and another for deleting records before a faculty entry, both logging actions to a backup table.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
Lab7 PL SQL Triggers Summary
The document explains database triggers, which are special stored procedures that execute automatically in response to events on a table or view. It highlights key differences between triggers and stored procedures, such as the inability to manually invoke triggers or pass parameters. Two specific triggers are detailed: one for inserting records before a faculty entry and another for deleting records before a faculty entry, both logging actions to a backup table.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
PL-SQL Lab 7: Database Triggers
A trigger is a special kind of stored procedure that automatically executes in response to
certain events on a particular table or view in a database.
Key differences between triggers and stored procedures:
1. Triggers cannot be manually invoked like stored procedures.
2. Triggers do not accept parameters.
3. Transactions (COMMIT or ROLLBACK) cannot be used within a trigger.
Trigger 1: Before Insert Trigger
Trigger Name: facultydata1 Event: BEFORE INSERT on 'faculty' Action: Inserts a record into 'faculty_backup' with action='insert', new_id from NEW.id, and current timestamp.
Trigger 2: Before Delete Trigger
Trigger Name: facultydata2 Event: BEFORE DELETE on 'faculty' Action: Inserts a record into 'faculty_backup' with action='delete', old_id from OLD.id, and current timestamp.