zoukankan      html  css  js  c++  java
  • 当条件满足时 触发器做增删改

    create or replace trigger trg_tab_sorting_theme_change
    before insert or update of PACKAGE_TYPE or delete
    on TAB_SORTING_THEME
    for each row
    declare
    -- local variables here
    begin
    if inserting then

    if :new.PACKAGE_TYPE='分拣机方案' then
    INSERT INTO tab_sorting_themes T
    (T.THEME_NAME,
    T.GUID,
    T.PACKAGE_TYPE,
    T.BL_START,
    T.PRINT_STYLE,
    T.INSERT_DATE,
    T.REGISTER_SITE_CODE,
    T.REGISTER_MAN_CODE,
    T.PRINT_STYLE_NAME,
    T.SERVICE_PROVIDER_CODE,
    T.SERVICE_NAME)
    VALUES
    (:new.THEME_NAME,
    :new.GUID,
    :new.PACKAGE_TYPE,
    :new.BL_START,
    :new.PRINT_STYLE,
    :new.INSERT_DATE,
    :new.REGISTER_SITE_CODE,
    :new.REGISTER_MAN_CODE,
    :new.PRINT_STYLE_NAME,
    :new.SERVICE_PROVIDER_CODE,
    :new.SERVICE_NAME);
    end if;

    elsif updating then
    if :new.PACKAGE_TYPE='分拣机方案' then
    update tab_sorting_themes a
    set a.THEME_NAME = :new.THEME_NAME,
    a.PACKAGE_TYPE = :new.PACKAGE_TYPE,
    a.PRINT_STYLE = :new.PRINT_STYLE,
    a.REGISTER_SITE_CODE = :new.REGISTER_SITE_CODE,
    a.REGISTER_MAN_CODE = :new.REGISTER_MAN_CODE,
    a.PRINT_STYLE_NAME = :new.PRINT_STYLE_NAME,
    a.SERVICE_PROVIDER_CODE = :new.SERVICE_PROVIDER_CODE,
    a.SERVICE_NAME = :new.SERVICE_NAME
    where a.GUID = :new.GUID;
    end if;
    else
    if :old.PACKAGE_TYPE = '分拣机方案' then
    delete tab_sorting_themes a where a.guid = :old.guid;
    end if;
    end if;
    end trg_tab_sorting_theme_change;

  • 相关阅读:
    android:descendantFocusability用法简析
    离开自己的安乐窝
    Android Material Design 中文版
    android Material
    jquery 效果网址分享
    Android判断TextView是否超出加省略号
    如何摆脱工具类
    android 框架
    gridview 横向滚动 一行显示
    自定义 spinner
  • 原文地址:https://www.cnblogs.com/yangpeng-jingjing/p/9225919.html
Copyright © 2011-2022 走看看