Triggers are is a named PL/SQL unit that is stored in the database and can be invoked repeatedly.While a trigger is enabled, the database automatically invokes it—that is, the trigger fires—whenever its triggering event occurs. While a trigger is disabled, it does not fire.
Follwing is the simple example of trigger, whenever any oprations like insert,update or delete is performed on the table emp, the AIUD_EMP will be fired automatically and will print the appropriate action message.
create or replace trigger AIUD_EMP
after insert or update or delete on EMP
for each row
begin
if inserting then
DBMS_OUTPUT.PUT_LINE('Record is Added');
end if;
if updating then
DBMS_OUTPUT.PUT_LINE('Record is Updated');
end if;
if deleting then
DBMS_OUTPUT.PUT_LINE('Record is Deleted');
end if;
end;