oracle 存储过程中出现异常的处理
写一个带有参数存储过程,PRO_CM_FD(v_reconnect_numinnumber,v_numidinnumber))_reconnect_num是2运行这个存储...
写一个 带有参数存储过程,PRO_CM_FD (v_reconnect_num in number,v_numid in number))
_reconnect_num 是 2 运行这个存储过程的时候 出现异常 次数不大于2的话 不进行异常处理,重新执行该存储过程, 第三次还是出现异常的话就进行异常处理。
存储过程代码:需要怎么改?
create or replace procedure PRO_CM_FD (v_reconnect_num in number,v_numid in number) is
sj date;
begin
select trunc(sysdate)-1 into sj from dual;
--execute immediate 'truncate table tds_cm_cell';
insert into t_wcity t
(t.ID,t.TIME, t.REGION_NAME,t.RNCAF12,t.RNCAF13,
t.BELONG_NAME,t.AREA_NAME,
t.GRID_NAME,t.TOWNS_NAME,t.MECHANINE_ANGLE,
t.RNCAN05, t.RNCAF05, t.RNCAF01,t.HONEYCOMB_TYPE,t.LONGITUDE, t.RNCAG04, t.RNCAH05, t.SITE_DISTANCE,t.LATITUDE,t.AZIMUTH_ANGLE,
t.ELECTRICITY_ANGLE,t.half_angle,t.HANG_HIGH,
t.PRIMARYSCRAMBLINGCODE,t.IF_ELECTRICITY )
select
t_wcity.nextval, s.TIME, s.REGION_NAME,s.RNCAF12,s.RNCAF13,
s.BELONG_NAME,s.AREA_NAME,
s.GRID_NAME,s.TOWNS_NAME,s.MECHANINE_ANGLE,
s.RNCAN05, s.RNCAF05, s.RNCAF01,s.HONEYCOMB_TYPE,s.LONGITUDE, s.RNCAG04, s.RNCAH05, s.SITE_DISTANCE,s.LATITUDE,s.AZIMUTH_ANGLE,
s.ELECTRICITY_ANGLE,s.half_angle,s.HANG_HIGH,
s.PRIMARYSCRAMBLINGCODE,s.IF_ELECTRICITY
from s_wcity s where s.time = sj;
update td_logs t set t.ft_ms = '成功' where t.id=v_numid;
commit;
exception
when OTHERS then
update td_logs t set t.ft_ms = '失败' where t.id=v_numid;end;
现在 这个是 出现异常了就直接 进行异常处理,就是加上次数逻辑 展开
_reconnect_num 是 2 运行这个存储过程的时候 出现异常 次数不大于2的话 不进行异常处理,重新执行该存储过程, 第三次还是出现异常的话就进行异常处理。
存储过程代码:需要怎么改?
create or replace procedure PRO_CM_FD (v_reconnect_num in number,v_numid in number) is
sj date;
begin
select trunc(sysdate)-1 into sj from dual;
--execute immediate 'truncate table tds_cm_cell';
insert into t_wcity t
(t.ID,t.TIME, t.REGION_NAME,t.RNCAF12,t.RNCAF13,
t.BELONG_NAME,t.AREA_NAME,
t.GRID_NAME,t.TOWNS_NAME,t.MECHANINE_ANGLE,
t.RNCAN05, t.RNCAF05, t.RNCAF01,t.HONEYCOMB_TYPE,t.LONGITUDE, t.RNCAG04, t.RNCAH05, t.SITE_DISTANCE,t.LATITUDE,t.AZIMUTH_ANGLE,
t.ELECTRICITY_ANGLE,t.half_angle,t.HANG_HIGH,
t.PRIMARYSCRAMBLINGCODE,t.IF_ELECTRICITY )
select
t_wcity.nextval, s.TIME, s.REGION_NAME,s.RNCAF12,s.RNCAF13,
s.BELONG_NAME,s.AREA_NAME,
s.GRID_NAME,s.TOWNS_NAME,s.MECHANINE_ANGLE,
s.RNCAN05, s.RNCAF05, s.RNCAF01,s.HONEYCOMB_TYPE,s.LONGITUDE, s.RNCAG04, s.RNCAH05, s.SITE_DISTANCE,s.LATITUDE,s.AZIMUTH_ANGLE,
s.ELECTRICITY_ANGLE,s.half_angle,s.HANG_HIGH,
s.PRIMARYSCRAMBLINGCODE,s.IF_ELECTRICITY
from s_wcity s where s.time = sj;
update td_logs t set t.ft_ms = '成功' where t.id=v_numid;
commit;
exception
when OTHERS then
update td_logs t set t.ft_ms = '失败' where t.id=v_numid;end;
现在 这个是 出现异常了就直接 进行异常处理,就是加上次数逻辑 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询