[英]How to provide data concurrency using oracle database?
I have a situation where I have a oracle database table which is available to end users for reporting purposes (only select queries). 我遇到的情况是我有一个oracle数据库表可供最终用户用于报告(仅选择查询)。 This is a fully replaced table and everyday when the data arrives I have to truncate the entire table and load it again with the new data.
这是一张完全替换的表,每天当数据到达时,我都必须截断整个表并用新数据再次加载它。 While I do this I want my table to be always available for the reporting.
在执行此操作时,我希望表格始终可用于报告。 But I dont want to make a copy of this table to achieve this.
但我不想复制此表来实现此目的。
You can DELETE
and INSERT
as much as you want within a single transaction, and no readers will know the difference until the final COMMIT
. 您可以在一个事务中根据需要进行
DELETE
和INSERT
,直到最后一次COMMIT
,读者才能知道其中的区别。 You can use a PL/SQL block like this to group the statements, and roll back the changes if there are any errors. 您可以使用这样的PL / SQL块对语句进行分组,并在出现任何错误时回滚更改。
begin
delete from mytable1;
insert into mytable1 select ...;
delete from mytable2;
insert into mytable2 select ...;
...
commit;
exception when others then
rollback;
raise;
end;
/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.