CREATE TRIGGER dodaj BEFORE INSERT ORDER 1 ON "DBA"."PRACOWNICY" REFERENCING NEW AS nowy FOR EACH ROWBEGIN if nowy.identyfikator = any(select identyfikator from pracownicy) then message 'Juz mamy taki identyfikator w bazie danych, Sir!' type action to client; rollback trigger else insert into adresy (identyfikator) values(nowy.identyfikator); message 'Dodano nieroba do bazy, Sir!' type action to client; end ifENDinsert into pracownicy (identyfikator, nazwisko, imię, "kod działu", "czas pracy", stawka, ubezpieczenie) values('EN110','Tusk','Jaroslaw','sp',4,600, 1)CREATE TRIGGER usun BEFORE DELETE ORDER 1 ON "DBA"."PRACOWNICY" REFERENCING OLD AS stary FOR EACH ROWBEGIN delete from adresy where identyfikator = stary.identyfikatorENDALTER TRIGGER dodaj BEFORE INSERT ORDER 1 ON "DBA"."PRACOWNICY" REFERENCING NEW AS nowy FOR EACH ROW /* WHEN ( search_condition ) */BEGIN if nowy.identyfikator = any(select identyfikator from pracownicy) then message 'Juz mamy taki identyfikator w bazie danych, Sir!' type action to client; rollback trigger else if nowy.stawka > 20 then message 'To jest VI RP, czlowiek nie mze tyle zarabiac, Sir!' type action to client; rollback trigger else insert into adresy (identyfikator) values(nowy.identyfikator); message 'Dodano nieroba do bazy, Sir!' type action to client; end if end ifEND===================================create table kredyty( nr_kr INTEGER not null, nr_kl INTEGER not null, wys_kr FLOAT, termin_przyznania DATE, termin_wplaty DATE,)create table klient( nr_k INTEGER not null, nazwisko char(30) not null, imie char(20) not null, kwota_zadluzenia FLOAT,)ALTER TRIGGER dodaj BEFORE INSERT ORDER 1 ON "DBA"."raty" REFERENCING NEW AS nowy FOR EACH ROWBEGIN update klient set kwota_zadluzenia = kwota_zadluzenia - nowy.wysokosc_raty where nowy.nr_k = nr_k; if (now() > (select termin_wplaty from kredyty where nr_kr = nowy.nr_kr)) then message 'Wpłata spóżniona!' type action to client; set nowy.karne_odsetki = nowy.karne_odsetki + (((1/1000) * nowy.wysokosc_raty)*(now() - (select termin_wplaty from kredyty where nr_kr = nowy.nr_kr))) end if; update kredyty set termin_wplaty = termin_wplaty + 30 where nr_kr = nowy.nr_kr; update kredyty set ilosc_rat = ilosc_rat - 1 where nr_kr = nowy.nr_kr;ENDinsert into raty (nr_kl, wysokosc_raty, data_wplaty, karne_odsetki, nr_kr)values (1,2500,'2007-05-08',0,1)