--创建一个表 保存最新的数据 create table tb_temp as select * from tbname where 1=2; --创建触发器 更新数据 create or replace trigger trg_tbname after insert or update on tbname for each row begin if inserting then insert into tb_temp values(:new.col1,:new.col2...); elsif updating then update tb_temp set col1=:new.col1,...; end if; end trg_tbname; / --根据自己的情况对tb_temp表中的数据进行清理,去掉旧数据(如:长时间没有更新的)
create table tb_temp as select * from tbname where 1=2;
--创建触发器 更新数据
create or replace trigger trg_tbname after insert or update on tbname
for each row
begin
if inserting then
insert into tb_temp values(:new.col1,:new.col2...);
elsif updating then
update tb_temp set col1=:new.col1,...;
end if;
end trg_tbname;
/
--根据自己的情况对tb_temp表中的数据进行清理,去掉旧数据(如:长时间没有更新的)