projektSBDnowy.txt
create or replace trigger new_worker after insert on workers for each row begin
dbms_output.put_line ("We have NEW worker!');
end;
create or replace trigger part_price before update of price on parts for each row begin
if :new.price < :old.price then
dbms_output.put_line ('New price is lower than the previous one!');
end if;
if :new.price > :old.price then
dbms_output.put_line ('Now we eam morę!!!');
end if;
excepdon
when others then
dbms_output.put_line ('New price is the same as the old one!');
end;
create or replace trigger dontremoveboss before delete on workers for each row begin
if :old.posidon = 'boss' then
raise_application_error(-20446,'Cannot delete BOSS!');
end if;
end;
create or replace trigger del_dients after delete on dients for each row begin
dbms_output.put_line(’Now we have one dient less. What a pitty!');
end;
create or replace trigger engine_type before inesert on types for each row begin
if :new.engine_type o 'diesel' and :new.engine_type <> 'gas'
then raise_applicadon_error(-20444,'We do not service that type of engines!');
end if; end;
Strona 2