Oracle触发器实例代码
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;
相关推荐
昊 2020-06-16
daillo 2020-04-07
applex 2019-12-29
zhaojp0 2019-12-11
xzero 2019-12-08
talkingDB 2019-12-02
zjuwangleicn 2020-06-25
debugjoker 2020-06-17
sunnyxuebuhui 2020-06-14
hanshangzhi 2020-06-14
ncomoon 2020-06-14
hanshangzhi 2020-06-12
wudaokouer 2020-04-16
一昕之代码 2020-02-20
李轮清 2020-05-11
URML 2020-05-10
nimeijian 2020-05-06
lpfvip00 2020-04-26