删除触发器,导致删除集为空时FK出现问题,并导致ORA-03113

时间:2020-03-31 18:08:15

标签: triggers foreign-keys constraints oracle12c

桌上的FK-

ALTER TABLE APP.BC_CUSTOM_SI_PROPERTIES ADD (  
  CONSTRAINT BC_SI_PROPS_CUSTOM_ATTR_FK 
    FOREIGN KEY (CUSTOM_ATTRIBUTE_MASTER_ID) 
     REFERENCES APP.BC_CUSTOM_ATTRIBUTE_MASTERS (CUSTOM_ATTRIBUTE_MASTER_ID)
      ON DELETE SET NULL
       DEFERRABLE INITIALLY IMMEDIATE
        ENABLE VALIDATE);

在BC_CUSTOM_SI_PROPERTIES上触发-

CREATE OR REPLACE TRIGGER APP.BC_ACS_SI_CUST_PROPERTY
AFTER DELETE OR INSERT OR UPDATE OF SI_PROPERTY_ID,PROPERTY_NAME
ON app.bc_custom_si_properties  REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
WHEN (NEW.INPUT_TYPE_CC=3 OR OLD.INPUT_TYPE_CC=3)
DECLARE
l_object_id app.bc_acs_obj_change_tracking.object_id%TYPE;
l_object_type app.bc_acs_obj_change_tracking.object_type%TYPE ;
l_owner app.bc_acs_obj_change_tracking.object_id2%TYPE;

BEGIN
   IF NOT app.utils_Pkg.workspace_dup_del_running_p = 1 THEN -- 
      IF SYS_CONTEXT('clus_ctx','import_in_progress') IS NULL THEN
         IF INSERTING OR UPDATING THEN
             l_object_id := :new.si_property_id;
             l_owner := :new.owner;
         ELSIF DELETING THEN
             l_object_id := :old.si_property_id;
             l_owner := :old.owner;
         END IF;

         l_object_type := 'SI_PROPERTY_ID';

         IF app.bc_acs_pkg.ws_access_policies_enabled_p (l_owner) = 1 THEN
            app.bc_acs_pkg.populate_obj_change_tracking
                (p_object_type => l_object_type,
                 p_object_id   => l_object_id,
                 p_object_id2  => l_owner,
                 p_object_id2_type => 'WORKSPACE'
                );
         END IF;
      END IF;
    END IF;

END ;
/

尝试从蟾蜍中从BC_CUSTOM_ATTRIBUTE_MASTERS删除CUSTOM_ATTRIBUTE_MASTER_ID时, ORA-03113通讯通道上的文件结尾。

最初,我在另一组具有复合触发器的表上面对该问题,我认为这是引起问题的复合触发器。 但是后来我检查了其他情况,即使是普通的删除触发器也引起了问题。

有人见过这种问题,并且知道解决方法。

0 个答案:

没有答案