forall使用及异常处理
2015-05-06 13:56
337 查看
<pre name="code" class="sql">--forall使用及异常处理 declare type t_series is table of aml_centric_task.series %type; type t_task_type is table of aml_centric_task.task_type %type; type t_model_type is table of aml_centric_task.model_type %type; type t_count is table of number; v_count number := 0; v_um varchar2(10) := 'RISK3'; s_series t_series; s_task_type t_task_type; s_model_type t_model_type; s_count t_count; cursor cur_sle is select /*+index(a idx_updat_dat_aml_centric_task)*/a.series, a.task_type, case a.model_type when '03' then '03' else '01' end model_type, count(1) curr_comp_task from aml_centric_task a where a.task_status = '03' and trunc(a.updated_date) > trunc(sysdate)-30 and a.ministrant = v_um and a.lapse_flag = '0' group by a.series, a.task_type, case a.model_type when '03' then '03' else '01' end; bulk_errors exception; pragma exception_init(bulk_errors, -24381); begin select count(0) into v_count from aml_centric_task a, (select e.relevancy_id, e.task_type, e.model_type from aml_centric_task_sha e union all select f.relevancy_id, f.task_type, '01' model_type from aml_centric_task_sha_c f) r where r.relevancy_id = a.relevancy_id and r.task_type = a.task_type; if v_count != 0 then open cur_sle; loop fetch cur_sle bulk collect into s_series, s_task_type, s_model_type, s_count limit 5000; exit when s_series.count = 0; begin forall i in 1 .. s_series.count save exceptions update aml_task_refresh_single sl set curr_comp_task = 'XXX'--s_count(i) --测试异常 where sl.series = s_series(i) and sl.tasktype = s_task_type(i) and sl.model_type = s_model_type(i) and sl.um_task = v_um; commit; exception when bulk_errors then for i in 1 .. sql%bulk_exceptions.count loop dbms_output.put_line(sqlerrm (-1 * sql%bulk_exceptions(i).error_code)); end loop; end; end loop; close cur_sle; end if; end;
相关文章推荐
- 使用BizTalk Server的Sql适配器出现“新事务不能登记到指定的事务处理器中”异常的处理
- java关于异常处理只使用try-finally而不使用catch
- SQL Server中使用异常处理调试存储过程
- MFC异常处理之TRACE, ASSERT, VERIFY使用方法
- 【通用】 使用 try catch 处理异常
- Android Timer使用的异常:Timer was canceled 处理方法
- 使用goto 使异常的处理更友善。
- 使用MediaPlayer出现The surface has been released 异常处理方法,附代码
- catch和throw同时使用---通过多个方法协作处理同一个异常
- C++中异常处理的基本思想及throw语句抛出异常的使用
- 使用try...catch语句处理异常
- SpringMVC 使用注解统一异常处理
- 异常处理的使用:
- Redis总结(五)缓存雪崩和缓存穿透等问题 Web API系列(三)统一异常处理 C#总结(一)AutoResetEvent的使用介绍(用AutoResetEvent实现同步) C#总结(二)事件Event 介绍总结 C#总结(三)DataGridView增加全选列 Web API系列(二)接口安全和参数校验 RabbitMQ学习系列(六): RabbitMQ 高可用集群
- Java语言如何进行异常处理,关键字:throws、throw、try、catch、finally分别如何使用?
- Spring.Net AOP 学习之旅: 使用 Throws Advice 处理异常
- MVC 验证和异常处理 自动验证使用 IDataErrorInfo 接口
- 【C#】52. 使用Flatten方法处理并行任务抛出的异常
- 007 使用SpringMVC开发restful API五--异常处理
- Java异常处理机制的详细讲解和使用技巧