create or replace trigger UserToTemp after insert or update or delete
on t_cs_one for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
tem1 varchar2(10);
begin
if inserting then
select count(mc2) into tem1 from t_cs_two where mc2=:NEW.mc1; //将
if tem1<=0 then
insert into t_cs_two (mc2) values(:NEW.mc1);
end if;
elsif updating then
update t_cs_two set mc2=:NEW.mc1 where mc2=:OLD.mc1;
elsif deleting then
delete from t_cs_two where mc2=:OLD.mc1;
end if;
exception
when integrity_error then
raise_application_error(errno, errmsg);
end;
on t_cs_one for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
tem1 varchar2(10);
begin
if inserting then
select count(mc2) into tem1 from t_cs_two where mc2=:NEW.mc1; //将
if tem1<=0 then
insert into t_cs_two (mc2) values(:NEW.mc1);
end if;
elsif updating then
update t_cs_two set mc2=:NEW.mc1 where mc2=:OLD.mc1;
elsif deleting then
delete from t_cs_two where mc2=:OLD.mc1;
end if;
exception
when integrity_error then
raise_application_error(errno, errmsg);
end;