zoukankan      html  css  js  c++  java
  • oracle创建触发器及作用举例

    --创建触发器及作用举例
    create or replace trigger tri
    before delete on emp 
    --在删除emp表数据之前需要做的事根据自己的业务去写,before是在之前做的事,after是在之后要做的事
    declare
    t_result number := 10;
    begin
      dbms_output.put_line('admin' || t_result);
    end tri;
    
    --下面是对表某些字段进行更新之后做的操作
    create or replace trigger TRI_DISPLAYTABLE
    after update of datatype,dbcolumnname,name on P#GCFR_T_FACTOR
    for each row
    declare
    errno number;
    errmsg varchar2(30);
    begin
    if updating ('datatype') then
    update GCFR_T_DISPLAYTABLE t set t.datatype = :new.datatype where t.viewname = :old.dbtablename
    and t.isvirtualcolumn = 0 and t.columncode = :old.dbcolumnname;
    end if;
    
    if updating ('dbcolumnname') then
    update GCFR_T_DISPLAYTABLE t set t.datatype = :new.datatype where t.viewname = :old.dbtablename
    and t.isvirtualcolumn = 0 and t.columncode = :old.dbcolumnname;
    end if;
    
    if updating ('name') then
    update GCFR_T_DISPLAYTABLE t set t.datatype = :new.datatype where t.viewname = :old.dbtablename
    and t.isvirtualcolumn = 0 and t.columncode = :old.dbcolumnname;
    end if;
    end;
    
    --删除触发器
    drop trigger tri;
  • 相关阅读:
    网页打开微信链接 无法返回
    wap尝试调取app(网易新闻为例)
    兼容性
    图片旋转效果
    a标签发送邮件
    windows 下的bash 环境安装npm
    css 设置滚动条的样式
    前端h5遇到的问题及解决办法
    safari input默认样式
    delphi 新版内存表 FDMemTable
  • 原文地址:https://www.cnblogs.com/hkdpp/p/8301926.html
Copyright © 2011-2022 走看看