当前位置:数据库 > DB2 >>

db2 CREATE trigger

db2 CREATE trigger
 
--监控某个表,当数据插入到表后,执行触发。
  www.zzzyk.com  
CREATE trigger tri_ins_UB_ORGINFO
    after INSERT ON UB_ORGINFO
           --for insert
     REFERENCING NEW AS n
     FOR EACH ROW  --MODE DB2SQL
      BEGIN ATOMIC
 
 delete from   UB_ORGINFO_HK;
 insert into UB_ORGINFO_HK (
 SELECT I_ID as ibankid, S_DISPLAYNAME as SBANKNAME,PBCBIGAREABANK  as sbanktype
  FROM UB_ORGINFO
  WHERE    -- BUSINESSCATEGORY !='1'    AND 
  I_STATUS=1
    AND S_DN IS NULL  AND PBCBIGAREABANK=276
     AND PBCBIGAREABANK IS not  NULL) ;
   
   end
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,