【发布时间】:2011-04-24 08:45:23
【问题描述】:
我正在开发一个使用 Oracle DB 的系统。 ETL 工具 (ODI) 将以下触发器放在表上以启用更改的数据捕获 (CDC)。
create or replace trigger SCHEMA.T$TABLE_NAME
after insert or update or delete on SCHEMA.TABLE_NAME
for each row
declare
V_FLAG VARCHAR(1);
V_ROW_ID VARCHAR2(60);
begin
if updating then
V_ROW_ID := :new.ROW_ID;
V_FLAG := 'U';
end if;
if inserting then
V_ROW_ID := :new.ROW_ID;
V_FLAG := 'I';
end if;
if deleting then
V_ROW_ID := :old.ROW_ID;
V_FLAG := 'D';
end if;
insert into SCHEMA.J$TABLE_NAME
(
JRN_SUBSCRIBER,
JRN_CONSUMED,
JRN_FLAG,
JRN_DATE,
ROW_ID
)
select JRN_SUBSCRIBER,
'0',
V_FLAG,
sysdate,
V_ROW_ID
from SCHEMA.SNP_SUBSCRIBERS
where JRN_TNAME = 'SCHEMA.TABLE_NAME'
/* The following line can be uncommented for symetric replication */
/* and upper(USER) <> upper('SCHEMA') */
;
end;
我的问题是这个东西不能识别更新。例如,当我对一行进行非常简单的更新时,它仍然会在 CDC 表中插入一个“I”,表示它将更新作为插入读取。这是怎么回事?这是什么奇怪的神谕?我没有在任何地方读到过。
提前致谢!
【问题讨论】: