oracle - 其他过程中的异常而不退出该过程
问题描述
我有一个 REFRESH FAST ON DEMAND 类型的物化视图,我有一个存储过程来刷新几个物化视图。如何在错误日志表中记录异常,但不停止记录错误行的过程,而是继续刷新以下物化视图 2.物化视图产生很多问题,如处理加载错误表?
谢谢你。
create or replace procedure actualizar_vistaM
is
begin
DBMS_MVIEW.REFRESH('VIEW 1')
DBMS_MVIEW.REFRESH('VIEW 2')
exception
when others then
INSERT INTO errors VALUES (value1,value2,value3)
end;
解决方案
我想您必须将每次刷新都包含在其自己的 begin-exception-end 块中。
create or replace procedure actualizar_vistaM
is
begin
begin
DBMS_MVIEW.REFRESH('VIEW 1');
exception
when others then
insert into errors values (...);
end;
--
begin
DBMS_MVIEW.REFRESH('VIEW 2');
exception
when others then
insert into errors values (...);
end;
end;
推荐阅读
- emacs - Org Capture:确定目标文件时提示信息
- amazon-web-services - 具有上下文根的 AWS 负载平衡
- c# - 项目中的依赖注入可以被解决方案中的其他项目使用
- java - Apache Spark:java.lang.OutOfMemoryError:Java 堆空间问题
- java - 基于当前值的加权随机性(不知道如何解释)
- shell - 使用 sed 将文本替换为特殊字符
- javascript - 根据范围数组动态过滤对象数组
- bulma - 从 Bulma SASS 中删除未使用的颜色
- sql - 如何从电话号码中删除空格(SQL)
- embedded - STM32 既做主又做从