zoukankan      html  css  js  c++  java
  • Oracle:复合触发器


    ----- CF_DEPTUCORGANIZATION  INSERT UPDATE DELETE 触发器
    CREATE  OR REPLACE TRIGGER tr_del_CF_DEPTUCORGANIZATION
    BEFORE INSERT OR UPDATE OR DELETE ON CF_DEPTUCORGANIZATION
    REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
    BEGIN
        IF INSERTING THEN
        
       INSERT INTO SYS_APP_LOG(ID , LOG_TYPE, MDF_TABLE_NAME , OPERATE_TYPE ,BEFORE_RECORD , AFTER_RECORD , MENDER_NAME , CREATED_BY,CREATION_DATE )
           VALUES(SYS_GUID(), 'DB_TRIGGER', 'CF_DEPTUCORGANIZATION' ,'INSERT', '','DEPTID='||CAST( :NEW.DEPTID AS VARCHAR2(1000))||',ORGANIZATIONID='||CAST(:NEW.ORGANIZATIONID AS VARCHAR2(1000))||',CREATEUSERID='||CAST ( :NEW.CREATEUSERID AS VARCHAR2(4000))||',CREATEDATE='||CAST ( :NEW.CREATEDATE AS VARCHAR2(4000))  , '', :NEW.MODIFYUSERID,sysdate );
           
            ELSIF UPDATING then
        
              
       INSERT INTO SYS_APP_LOG(ID , LOG_TYPE, MDF_TABLE_NAME , OPERATE_TYPE ,BEFORE_RECORD , AFTER_RECORD , MENDER_NAME , CREATED_BY,CREATION_DATE )
           VALUES(SYS_GUID(), 'DB_TRIGGER', 'CF_DEPTUCORGANIZATION' ,'UPDATE', 'DEPTID='||CAST( :OLD.DEPTID AS VARCHAR2(1000))||',ORGANIZATIONID='||CAST(:OLD.ORGANIZATIONID AS VARCHAR2(1000))||',CREATEUSERID='||CAST ( :OLD.CREATEUSERID AS VARCHAR2(4000))||',CREATEDATE='||CAST ( :OLD.CREATEDATE AS VARCHAR2(4000)),'DEPTID='||CAST( :NEW.DEPTID AS VARCHAR2(1000))||',ORGANIZATIONID='||CAST(:NEW.ORGANIZATIONID AS VARCHAR2(1000))||',CREATEUSERID='||CAST ( :NEW.CREATEUSERID AS VARCHAR2(4000))||',CREATEDATE='||CAST ( :NEW.CREATEDATE AS VARCHAR2(4000))  , '', :NEW.MODIFYUSERID,sysdate );
           
           
               ELSIF DELETING then
           
               INSERT INTO SYS_APP_LOG(ID , LOG_TYPE, MDF_TABLE_NAME , OPERATE_TYPE ,BEFORE_RECORD , AFTER_RECORD , MENDER_NAME , CREATED_BY,CREATION_DATE )
           VALUES(SYS_GUID(), 'DB_TRIGGER', 'CF_DEPTUCORGANIZATION' ,'DELETE', 'DEPTID='||CAST( :OLD.DEPTID AS VARCHAR2(1000))||',ORGANIZATIONID='||CAST(:OLD.ORGANIZATIONID AS VARCHAR2(1000))||',CREATEUSERID='||CAST ( :OLD.CREATEUSERID AS VARCHAR2(4000))||',CREATEDATE='||CAST ( :OLD.CREATEDATE AS VARCHAR2(4000))  ,'', '', :OLD.MODIFYUSERID,sysdate );
           
           
        ELSE
            NULL;
        END IF;
        EXCEPTION
          WHEN OTHERS THEN
            NULL;
            
            
    END;

  • 相关阅读:
    Javascript绝句欣赏
    【转载】浏览器的工作原理:新式网络浏览器幕后揭秘
    从零开始编写自己的JavaScript框架(二)
    从零开始编写自己的JavaScript框架(一)
    CSS 编码中超级有用的工具集合
    创建简单的响应式HTML5模版
    Javascript中的垃圾回收机制
    JavaScript继承详解(五)
    线上应用接入sentinel的第一个流控规则
    sentinel控制台监控数据持久化【MySQL】
  • 原文地址:https://www.cnblogs.com/tiancai/p/6862037.html
Copyright © 2011-2022 走看看