oracle 存储过程如何捕获特定异常
proceduregetzlrecordNewStatisticsInfo(v_startdateinvarchar2,v_enddateinvarchar2,varER...
procedure getzlrecordNewStatisticsInfo(v_startdate in varchar2,
v_enddate in varchar2,
varERRMSG out varchar2,
p_c1 out cursortype) as
begin
open p_c1 for
with t as
(select * from LY_CONTRACT c )
select nvl2(FILE_DATE,to_char(FILE_DATE,'mm')||'月','合计')FILE_DATE from t
where FILE_DATE is not null
group by rollup(FILE_DATE)
order by FILE_DATE;
exception
when others then
if sqlcode=-01427
then
select wm_concat( '合同号为'||contractno||'的合同对应'||a||'个有效备案:'||record_no)
into varERRMSG from ( select * from LY_CONTRACT c
where exists
(select FILE_ID
from LY_CONTRACT_RECORD r
where r.Contract_Id = c.file_id
and exists
(select FILE_ID
from ly_s_docbase where FILE_ID = r.file_id
and is_flow in (2, 3) where a>1;
else
varERRMSG := sqlcode;
end if;
open p_c1 for
select null from dual;
end getzlrecordNewStatisticsInfo;
为什么进入不了异常部分 展开
v_enddate in varchar2,
varERRMSG out varchar2,
p_c1 out cursortype) as
begin
open p_c1 for
with t as
(select * from LY_CONTRACT c )
select nvl2(FILE_DATE,to_char(FILE_DATE,'mm')||'月','合计')FILE_DATE from t
where FILE_DATE is not null
group by rollup(FILE_DATE)
order by FILE_DATE;
exception
when others then
if sqlcode=-01427
then
select wm_concat( '合同号为'||contractno||'的合同对应'||a||'个有效备案:'||record_no)
into varERRMSG from ( select * from LY_CONTRACT c
where exists
(select FILE_ID
from LY_CONTRACT_RECORD r
where r.Contract_Id = c.file_id
and exists
(select FILE_ID
from ly_s_docbase where FILE_ID = r.file_id
and is_flow in (2, 3) where a>1;
else
varERRMSG := sqlcode;
end if;
open p_c1 for
select null from dual;
end getzlrecordNewStatisticsInfo;
为什么进入不了异常部分 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询