我无法使用搜索找到答案。如何使用我创建的触发器从表FK_SOCRD_ID
获取列CR_MDT
的值以插入表CR_MDT_AUDIT
:
CREATE OR REPLACE TRIGGER "CR_MDT_AUDIT"
before insert or delete or update on CR_MDT
for each row
declare
V_user varchar2 (30);
V_date varchar2 (30);
begin
IF inserting THEN
insert into CR_MDT_AUDIT (new_value, OLD_VALUE, user_name, entry_date, operation, FK_SOCRD_ID)
VALUES (:NEW.CR_MDT_ABSTRACTOR_DT, NULL, v_user, v_date, 'Abstraction Completed');
ELSIF DELETING THEN
insert into CR_MDT_AUDIT (new_value, OLD_VALUE, user_name, entry_date, operation, FK_SOCRD_ID)
VALUES (null, :OLD.CR_MDT_ABSTRACTOR_DT, v_user, v_date, 'delete');
ELSIF UPDATING THEN
insert into CR_MDT_AUDIT (new_value, OLD_VALUE, user_name, entry_date, operation, FK_SOCRD_ID)
VALUES (:NEW.CR_MDT_ABSTRACTOR_DT, :OLD.CR_MDT_ABSTRACTOR_DT, v_user, v_date, 'Update');
END IF;
END;
我不知道要使用哪个条款或措辞,以便FK_SOCRD_ID
的{{1}}值添加到CR_MDT
表。基本上,我试图找到一种方法来确定改变的位置。