开发者社区> 问答> 正文

plsql抽风报错的事,求眼力好的看看两段代码,上面报错,下面可以执行 ?报错

plsql抽风报错的事,求眼力好的看看两段代码,上面报错,下面可以执行,我他么要兔血了,可以拷贝过去执行试试

图片说明

 declare  
   cresult int;
   val int; --全局变量  
   errorException exception; --申明异常  
begin   
    val := 1/0; 
    exception 
         when errorException then   
             cresult := -1;
       when others then  
             cresult := 0; 
end;

 DECLARE   
   cresult int; 
   val int; --全局变量  
   errorException exception; --申明异常   
begin   
     val := 1/0;  
     exception  --异常捕捉,不要把有需要的代码放在异常捕捉后面,有异常才会执行异常代码下所有代码,没有异常不会执行  
         when errorException then   
              cresult := -1;
         when others then   
              cresult := 0;  
end;  

展开
收起
爱吃鱼的程序员 2020-06-23 15:03:13 545 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    http://www.bejson.com/convert/fullhalf/在线全角半角转换下

    你这什么玩意。。

    看下这个是不是有特殊字符
    http://www.cnblogs.com/songdavid/archive/2011/09/13/2174908.html

    https://zhidao.baidu.com/question/496894678518299364.html

    2020-06-23 15:03:31
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载