一个存储过程里的片段是这样的
begin
counter:=0;
select count(1) into counter from personinfo@dblink_510322;
EXCEPTION
when others then
v_ErrorCode := SQLCODE;
v_ErrorText := SUBSTR(SQLERRM, 1, 200);
insert into
auto_sync_errormsg(
id,code,name,type,count,status,error_msg,create_date
)
values(seq_auto_sync_error.nextval,
'510322',
'富顺县',
'计算总数出错',
counter,
'1',
v_ErrorCode||'数据抓取失败'|| v_ErrorText,
sysdate
);
end;
然后@dblink_510322 这个dblink有时候连不通,执行到这儿就会卡住,而且异常抓取不到。我单独拿出来当作匿名块执行,直接就弹窗提示error:连接超时。这是为什么呢,为什么捕捉不到异常呢?
大神来解救下
你这个SQL写的有问题吧 你单独拿出来试试
select count(1) into counter from personinfo@dblink_510322;
这句SQL好像写的有问题