TRIGGER PROGRAM by prabhunathan

VIEWS: 2 PAGES: 2

									TRIGGER PROGRAM

INSERTION

Create or replace trigger trig1 before insert on emd for each row

declare

begin

if:new.salary<=50000 then

RAISE_APPLICATION_ERROR(-20020,’invalid salary to insert’);

end if;

end;

/

DELETION

Create or replace trigger trig1 before delete on emd for each row

declare

begin

insert into emd1 values(:old.ename,:old.eno,:old.salary);

end;

/

UPDATION

Create or replace trigger trig1 before update on emd for each row

declare

begin

if:new.salary<=:old.salary then

RAISE_APPLICATION_ERROR(-20020,’new salary must be greater than old salary’);

end if;

end;

/

								
To top