zoukankan      html  css  js  c++  java
  • ORACLE触发器判断是否更新了某个字段

    判断oracle单条表记录更新时更新的是哪几个字段

    首先使用触发器判断执行的是否是更新语句

    create or replace trigger jc_customer_upd_tr
      before insert or update on jc_customer
      for each row  --行级触发
    declare
      v_operation varchar2(500);--操作内容
      
    begin
      --如果信息变更,则将变更的字段提取出来,拼接并插入日志表中的一个字段
      if updating then 
    end if; end jc_customer_upd_tr;

    判断更改的哪些字段,方法一是插入之前进行新旧值的比对

      if :OLD.Name!=:NEW.Name then   
           v_operation:=v_operation||'旧1:'||:OLD.Name||'新1:'||:NEW.Name||';';
      end if;

    另外一种方法是使用updating('XX')的方法来判断更新语句是否含有该字段的更新

      if updating('Name') then
          v_operation:=v_operation||'旧2:'||:OLD.Name||'新2:'||:NEW.Name||';';
       end if;
  • 相关阅读:
    bootstrap之按钮和图片
    bootstrap之表单
    bootstrap之表格
    bootstrap+html5+css3
    网站链接
    linux下查看和添加PATH环境变量
    安装Memcache的PHP扩展
    ./configure
    如何学习前端?
    实战深度学习(下)OpenCV库
  • 原文地址:https://www.cnblogs.com/zjfjava/p/9155171.html
Copyright © 2011-2022 走看看