常青树 发表于 2016-11-14 06:31:18

db2 CREATE trigger

  --监控某个表,当数据插入到表后,执行触发。
  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
  
---------------------
页: [1]
查看完整版本: db2 CREATE trigger