Triggers In brief in Oracle PLSQL
What is Trigger in Oracle?
It is reusable oracle plsql program, associated with oracle tables.
Fired implicitly on tables\views on which it is created.
When Database event occurs associated trigger will be invoke to perform operations.
It is not performing through select statement.
Any number of trigger can be create on a table.
Can create maximum 12 combinations on a table.
Help to maintain data integrity.
Automatically backup of data for update\delete operations.
Trace unwanted updates and deletes.
Implement complex business rules which are not possible through constraints.
Validate DML statements before modifications on table.
Level of Trigger Executions:
Row level: An event is trigger on each row updated\deleted\inserted in table.
Statement level: An event is trigger on each statement executed.
What are the different categories of trigger?
Instead of Triggers
System Event Triggers
For which action\operation trigger fired?
Trigger is fired for below event,
CREATE [OR REPLACE] TRIGGER trigger_name
ON tbl_name [ FOR EACH ROW] Declare
—– Variable declarations
—-exception handling code
CREATE OR REPLACE TRIGGER before_insert_employee
FOR EACH ROW
INSERT INTO VEHICLE VALUES (‘VH010′,’Honda’,’100′,’Kanpur’);