Oracle触发器实例代码
程序员文章站
2022-04-23 19:57:44
oracle触发器,用于选单后修改选单的表的触发动作。
--备货检验选单后 回写备货状态
create or replace trigger tri_tobac...
oracle触发器,用于选单后修改选单的表的触发动作。
--备货检验选单后 回写备货状态 create or replace trigger tri_tobaccostockinsert after insert on "tobaccostockquality" for each row begin update "goodsstock" set "firstcheckstate"=-1 where "id"=:new."goodsstock_id"; end; --备货检验修改选单后 回写备货状态 create or replace trigger tri_tobaccostockupdate before update on "tobaccostockquality" for each row begin update "goodsstock" set "firstcheckstate"=decode(to_number(:new."auditstatus"),0,-1) where "id"=:new."goodsstock_id"; if :new."goodsstock_id"<>:old."goodsstock_id" then update "goodsstock" set "firstcheckstate"=-1 where "id"=:old."goodsstock_id"; end if; end; --备货检验删除单据后 回写备货状态 create or replace trigger tri_tobaccostockdelete before delete on "tobaccostockquality" for each row begin update "goodsstock" set "firstcheckstate"=-1 where "id"=:old."goodsstock_id"; end;
以上所述是小编给大家介绍的oracle触发器实例代码,希望对大家有所帮助