trigger


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 tellme
option textarea trigger
Manual therapy for trigger points
Bone, J F @ Triggerman
Envelopes gates and triggers
triggered modifiers
les08 use triggers whylearnit
High speed photography sound trigger ZPT
function trigger error
les08 audit trigger1 tellme
option?d form submit trigger
Insyderz Trigger Happy
function trigger error
TriggerDemo csproj FileListAbsolute
triggers
Trigger point massage
Model podsystemu TRIGger urządzenia SCPI
2006 08 the Sequel Stored Procedures, Triggers, and Views in Mysql 5
les08 cre triggers tellme

więcej podobnych podstron