我可以使用REFRESH FAST ON COMMIT创建MVIEW。但是,当我插入或更新基础表(例如Capture_date列)时,视图不会刷新。它只能在我指定REFRESH FORCE ON COMMIT时刷新,但由于性能问题,我不想完全刷新。
CREATE MATERIALIZED VIEW LOG ON EXP_DC_HST
WITH SEQUENCE, ROWID
(ACTIVITY_DESCRIPTION, ACTIVITY_TYPE, CD1, CD2, CD3, CD4, Capture_date)
INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW EXP_DC_AMEND_MVIEW
PARALLEL
BUILD IMMEDIATE
REFRESH FAST ON COMMIT AS
select H.ACTIVITY_DESCRIPTION, H.ACTIVITY_TYPE, H.CD1, H.CD2, H.CD3, H.CD4, H.CD1|| H.CD2|| trim(H.CD3)||'-'||LPAD(H.CD4,2,0) as EXP_DC_NUMBER,
max(H.Capture_date) as DC_STATUS_TIME
from EXP_DC_HST H where H.ACTIVITY_TYPE = 'AMENDMENT'
AND INSTR(H.ACTIVITY_DESCRIPTION, 'INFORMAL') = 0
group by H.ACTIVITY_DESCRIPTION, H.ACTIVITY_TYPE, H.CD1, H.CD2, H.CD3, H.CD4;