ALTER TRIGGER "Wstaw_promocje" after UPDATE, INSERT, DELETE on tPromocje for each row
BEGIN
declare Szukaj_prom cursor for select Id_prom, Dotyczy_modelu from tPromocje;
declare Szukaj_aut cursor for select Nr_seryjny, Model from tAuta;
declare temp_prom int;
declare temp_auto int;
declare temp_model varchar(10);
declare temp_model2 varchar(10);
--truncate table Promocje_w_autach;
open Szukaj_prom;
open Szukaj_aut;
petla1 : LOOP --początek pętli
fetch next Szukaj_prom into temp_prom, temp_model;
IF SQLCODE <> 0 THEN leave petla1;
end if;
petla2 : LOOP
fetch next Szukaj_aut into temp_auto, temp_model2;
IF SQLCODE <> 0 THEN leave petla2;
end if;
if temp_model = temp_model2 then
insert into Promocje_w_autach values (temp_prom,temp_auto);
end if;
end LOOP;
fetch first Szukaj_aut into temp_auto, temp_model2;
end LOOP;
close Szukaj_aut;
close Szukaj_prom;
END
Wyszukiwarka
Podobne podstrony:
les08 man triggers tellmeoption textarea triggerManual therapy for trigger pointsBone, J F @ TriggermanEnvelopes gates and triggerstriggered modifiersles08 use triggers whylearnitHigh speed photography sound trigger ZPTfunction trigger errorles08 audit trigger1 tellmeoption?d form submit triggerInsyderz Trigger Happyfunction trigger errorTriggerDemo csproj FileListAbsolutetriggersTrigger point massageModel podsystemu TRIGger urządzenia SCPI2006 08 the Sequel Stored Procedures, Triggers, and Views in Mysql 5les08 cre triggers tellmewięcej podobnych podstron