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;

相关文章:

  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-05-17
  • 2021-07-17
  • 2023-03-20
猜你喜欢
  • 2022-02-20
  • 2022-03-09
  • 2021-06-09
  • 2021-05-27
  • 2021-06-28
  • 2022-03-09
相关资源
相似解决方案