存储过程中:
 select leftPosition,rightPosition,costRate,updateDate,todayCust,nettingProfitloss,todayNetting,
   todayflatplate,flatplateProfitloss,todayHand,handProfitloss
   into 
class_leftAmt,class_rightAmt,class_costAmt,class_updateDate,class_todayCust,class_nettingProfitloss,class_todayNetting,
   class_todayflatplate,class_flatplateProfitloss,class_todayHand,class_handProfitloss
   from ck_classTotal
   where productCode=total_productCode and currencyName=Detail_currencyName and exposureNumber=Detail_exposureNumber for update wait 1;
   if SQL%ROWCOUNT = 0 then
             RAISE_APPLICATION_ERROR(-20000,'没有数据!'); 
   end if;
在java代码中如何取得'没有数据!'这个错误描述呢?

解决方案 »

  1.   

    在这之前,自定义一个错误名称,作为关联
    DECLARE
    noData EXCEPTION;
    PRAGMA EXCEPTION_INIT(noData , -20000);
    然后在Exception里
    EXCEPTION
    WHEN noData THEN
    .....
      

  2.   

    没用过oracle RAISE_APPLICATION_ERROR(-20000,'没有数据!'); 
     这句话貌似是抛异常了啊 java在处理的时候会发现错误 throw exception的 你直接return 2000.在java代码里获取到2000 然后找到2000对应的错误值不就可以了 
    看下 CallableStatement 用 {? = call  sp} ?返回的就是return的状态值