Pl sql if inserting updating
CREATE [ OR REPLACE ] TRIGGER trigger_name AFTER INSERT or UPDATE or DELETE ON table_name [ FOR EACH ROW ] DECLARE -- variable declarations BEGIN -- trigger code EXCEPTION WHEN ...
CREATE or REPLACE TRIGGER emp_after_insert AFTER INSERT ON emp FOR EACH ROW DECLARE BEGIN insert into emp_backup values (:new.empid, :new.fname, :new.lname); DBMS_OUTPUT.In this chapter, we will discuss Triggers in PL/SQL.Triggers are stored programs, which are automatically executed or fired when some events occur.For example, a table and a trigger can have the same name (however, to avoid confusion, this is not recommended). If a triggering statement includes a column list, the trigger is fired only when one of the specified columns is updated.
If a triggering statement omits a column list, the trigger is fired when any column of the associated table is updated.Because the trigger uses the clause, it might be executed multiple times, such as when updating or deleting multiple rows.