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

oracle的触发器增删改实例

oracle的触发器增删改实例
 
----------对一张表增删改的触发--------------
 
CREATE OR REPLACE
TRIGGER ZHJK
AFTER INSERT OR UPDATE OR DELETE ON ITIL_USR_DEPARTMENT_DAG
FOR EACH ROW 
BEGIN
 case
 when inserting then
   insert into sys(id,ORG_NAME,ALIAS,PARENT_ORG_NAME) values(:new.id,:new.name,:new.alias,:new.p_name);
  when updating then
    update sys set ORG_NAME=:new.name,ALIAS=:new.alias,PARENT_ORG_NAME=:new.p_name where id=:new.id;
    when deleting then
    delete sys where id=:old.id;
   end case;
END;

 


CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,