我已经尽力自己做到这一点,但我无处可去。这是我的触发器定义:
CREATE OR REPLACE TRIGGER KK_BUDGET_TYPE_TR AFTER
INSERT OR
UPDATE OR
DELETE ON PS_KK_BUDGET_TYPE FOR EACH ROW DECLARE V_AUDIT_OPRID VARCHAR2(64);
V_JOB_NUMBER NUMBER;
BEGIN
DBMS_APPLICATION_INFO.READ_CLIENT_INFO(V_AUDIT_OPRID);
IF INSERTING THEN
INSERT
INTO PS_KK_BD_TYPE_AUD VALUES
(
GET_PS_OPRID(V_AUDIT_OPRID),
SYSDATE,
'A',
:NEW.SETID1,
:NEW.LEDGER_GROUP,
:NEW.EFFDT,
:NEW.EFF_STATUS,
:NEW.CNTRL_OPTN,
:NEW.BUDGET_STATUS,
:NEW.DESCR,
:NEW.BUDG_TYPE,
:NEW.ASSOC_EXP_BD,
:NEW.PARENT_BUDGET,
:NEW.CHILD_EXCEED,
:NEW.CONTROL_CHARTFIELD,
:NEW.ALL_VALUES,
:NEW.FILTER_CHARTFIELD,
:NEW.TREE_NAME,
:NEW.TREE_LEVEL,
:NEW.ENABLE_FS,
:NEW.KK_REV_TRACK_LG,
:NEW.TOLERANCE,
:NEW.BALANCED_LINES,
:NEW.KK_ENABLE_STAT,
:NEW.SUBTYPE,
:NEW.EXPIRE_CHARTFIELD
);
ELSE
IF DELETING THEN
INSERT
INTO PS_KK_BD_TYPE_AUD VALUES
(
GET_PS_OPRID(V_AUDIT_OPRID),
SYSDATE,
'D',
:OLD.SETID1,
:OLD.LEDGER_GROUP,
:OLD.EFFDT,
:OLD.EFF_STATUS,
:OLD.CNTRL_OPTN,
:OLD.BUDGET_STATUS,
:OLD.DESCR,
:OLD.BUDG_TYPE,
:OLD.ASSOC_EXP_BD,
:OLD.PARENT_BUDGET,
:OLD.CHILD_EXCEED,
:OLD.CONTROL_CHARTFIELD,
:OLD.ALL_VALUES,
:OLD.FILTER_CHARTFIELD,
:OLD.TREE_NAME,
:OLD.TREE_LEVEL,
:OLD.ENABLE_FS,
:OLD.KK_REV_TRACK_LG,
:OLD.TOLERANCE,
:OLD.BALANCED_LINES,
:OLD.KK_ENABLE_STAT,
:OLD.SUBTYPE,
:OLD.EXPIRE_CHARTFIELD
);
ELSE
INSERT
INTO PS_KK_BD_TYPE_AUD VALUES
(
GET_PS_OPRID(V_AUDIT_OPRID),
SYSDATE,
'K',
:OLD.SETID1,
:OLD.LEDGER_GROUP,
:OLD.EFFDT,
:OLD.EFF_STATUS,
:OLD.CNTRL_OPTN,
:OLD.BUDGET_STATUS,
:OLD.DESCR,
:OLD.BUDG_TYPE,
:OLD.ASSOC_EXP_BD,
:OLD.PARENT_BUDGET,
:OLD.CHILD_EXCEED,
:OLD.CONTROL_CHARTFIELD,
:OLD.ALL_VALUES,
:OLD.FILTER_CHARTFIELD,
:OLD.TREE_NAME,
:OLD.TREE_LEVEL,
:OLD.ENABLE_FS,
:OLD.KK_REV_TRACK_LG,
:OLD.TOLERANCE,
:OLD.BALANCED_LINES,
:OLD.KK_ENABLE_STAT,
:OLD.SUBTYPE,
:OLD.EXPIRE_CHARTFIELD
);
INSERT
INTO PS_KK_BD_TYPE_AUD VALUES
(
GET_PS_OPRID(V_AUDIT_OPRID),
SYSDATE,
'N',
:NEW.SETID1,
:NEW.LEDGER_GROUP,
:NEW.EFFDT,
:NEW.EFF_STATUS,
:NEW.CNTRL_OPTN,
:NEW.BUDGET_STATUS,
:NEW.DESCR,
:NEW.BUDG_TYPE,
:NEW.ASSOC_EXP_BD,
:NEW.PARENT_BUDGET,
:NEW.CHILD_EXCEED,
:NEW.CONTROL_CHARTFIELD,
:NEW.ALL_VALUES,
:NEW.FILTER_CHARTFIELD,
:NEW.TREE_NAME,
:NEW.TREE_LEVEL,
:NEW.ENABLE_FS,
:NEW.KK_REV_TRACK_LG,
:NEW.TOLERANCE,
:NEW.BALANCED_LINES,
:NEW.KK_ENABLE_STAT,
:NEW.SUBTYPE,
:NEW.EXPIRE_CHARTFIELD
);
END IF;
END IF;
DBMS_JOB.submit
(
job => V_JOB_NUMBER, what => 'logger "KK_BD_TYPE_AUD_CHG"', next_date => SYSDATE
)
;
END KK_BUDGET_TYPE_TR;
除了“由于提交问题,这是一个糟糕的想法”之外,这正是我们想要发生的事情,即使发生回滚等等。某处的某些代码正在更新某些用户不应该能够更新的表。我们完全无法确定用户在做什么,因此我们可以复制问题,因此我们当前的目标是立即获得特定表上数据已更改的通知,然后让我们立即联系用户以找出他们当时在做什么。系统管理员想在 syslog 上放置一个过滤器,所以他希望我使用以下行运行命令行
logger "KK_BD_TYPE_AUD_CHG"
结果是
ORA-06550: line 1, column 100:
PLS-00103: Encountered the symbol "KK_BD_TYPE_AUD_CHG" when expecting one of the following:
:= . ( @ % ;
The symbol "; was inserted before "KK_BD_TYPE_AUD_CHG" to continue.
所以在这一点上我很茫然,我已经脱离了我的元素。任何帮助或替代选项将不胜感激。