Oracle触发器的一个简单例子

用户状态变成离职状态,系统配置表被触发,修改配置表状态 

create or replace trigger BASEDB_USERLEFT
  before update or delete on basedb_users 
  for each row
declare
  -- local variables here
  varcount number;
begin
    --select loginid into userloginid from basedb_users where status=:new.status;
    if updating or deleting then
      select count(*) into varcount from basedb_sysconfuser where loginid=:new.loginid;
        if varcount>0 and :new.status='5' then
            update basedb_sysconfuser set isvalid='0',last_date=sysdate,action_sign='U' where loginid=:new.loginid;
        end if;  
    end if;

end BASEDB_USERLEFT;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章