Oracle – PL-SQL – Trigger – After Insert OR Update OR Delete
We can create a trigger with multiple actions (i.e. Insert or Update or Delete) here sharing an example of trigger in which we can handle three actions as insert, update and delete.
Example:
CREATE OR REPLACE TRIGGER EMPLOYEE_AI_AU_AD AFTER INSERT OR UPDATE OR DELETE ON EMPLOYEE FOR EACH ROW DECLARE V_Msg VARCHAR2(30) := 'Row Level Trigger Fired'; BEGIN IF INSERTING THEN dbms_output.put_line(V_Msg || ' After Inserting'); ELSIF UPDATING THEN dbms_output.put_line(V_Msg || ' After Updating'); ELSIF DELETING THEN dbms_output.put_line(V_Msg || ' After Deleting'); END IF; END EMPLOYEE_AI_AU_AD;
Hi, Varinder! Nice post
Thanks Ania
I am a beginner in SQL Oracle and I was wondering if you can give me some tips regarding a trigger I am working on. The trigger has to update a table before insert, so that when someone tries to declare a new value for a row within a column, the start date and end date columns will change.
If you have time to think about this I can post the actual table and the progress I made on the trigger. Many thanks!
Hi Ania,
Please refer given post ..may this will help you understand about the trigger.
http://www.varindersandhu.in/2011/12/19/oracle-pl-sql-introduction-of-triggers/
If you have still have any question then you can send me an email.