• mysql 触发器示例和注解


    
    
    -- 格式
    CREATE TRIGGER   触发器名称
    AFTER|before     insert|update|delete  ON 触发表
    FOR EACH ROW
    BEGIN
            insert into  处理表values(..,...,...)
            update  处理表 set id=new.id,name=new.name,...
        delete from t_zg_loanee_apply_trigger where id=old.ID;
    END;
    
    
    -- 注释
    after  :执行后触发
    before: 执行前触发
    new   :代表触发表的插入后或者更新后的数据
    old     :代表触发表更新前的数据信息或删除之前的数据信息


    --
    insert drop trigger if exists t_afterinsert_on_tab1; CREATE TRIGGER t_afterinsert_on_tab1 AFTER INSERT ON t_zg_loanee_apply FOR EACH ROW BEGIN insert into t_zg_loanee_apply_trigger(ID,LOAN_DATE,PRODUCT_ID,OOP_ORG_NAME,REPAY_TYPE,DELETE_STATUS,CREATEDON,DEBT_TYPE,OBTAIN_CHANNEL,PACKAGE_NUMBER,LOCK_STATUS,IS_TPAY) values(new.ID, new.LOAN_DATE, new.PRODUCT_ID, new.OOP_ORG_NAME, new.REPAY_TYPE, new.DELETE_STATUS, new.CREATEDON,DEBT_TYPE, new.OBTAIN_CHANNEL, new.PACKAGE_NUMBER, new.LOCK_STATUS, new.IS_TPAY); END; -- update drop trigger if exists t_afterinsert_on_t_zg_loanee_apply_upd; CREATE TRIGGER t_afterinsert_on_t_zg_loanee_apply_upd AFTER UPDATE ON t_zg_loanee_apply FOR EACH ROW BEGIN UPDATE t_zg_loanee_apply_trigger SET LOAN_DATE=new.LOAN_DATE, PRODUCT_ID=new.PRODUCT_ID, OOP_ORG_NAME=new.OOP_ORG_NAME, REPAY_TYPE=new.REPAY_TYPE, DELETE_STATUS=new.DELETE_STATUS, CREATEDON=new.CREATEDON, DEBT_TYPE=new.DEBT_TYPE, OBTAIN_CHANNEL=new.OBTAIN_CHANNEL, PACKAGE_NUMBER=new.PACKAGE_NUMBER, LOCK_STATUS=new.LOCK_STATUS, IS_TPAY=new.IS_TPAY where id=old.ID; END; -- delete drop trigger if exists t_afterinsert_on_t_zg_loanee_apply_del; CREATE TRIGGER t_afterinsert_on_t_zg_loanee_apply_del AFTER delete ON t_zg_loanee_apply FOR EACH ROW BEGIN delete from t_zg_loanee_apply_trigger where id=old.ID; END;
  • 相关阅读:
    KlayGE的PNTriangle例子支持Instanced Tessellation了
    KlayGE中的延迟渲染(一)
    KlayGE中的延迟渲染(五)完结篇
    KlayGE中的延迟渲染(二)
    KlayGE中的延迟渲染(三)
    KlayGE中的延迟渲染(四)
    几大移动平台的纯C/C++开发调查
    用2个float模拟double
    开放的3D扫描人头数据!
    IP 点分十进制表示法
  • 原文地址:https://www.cnblogs.com/yangjinwang/p/6256134.html
Copyright © 2020-2023  润新知