Oracle 存储过程:这一段存储过程存在什么错误(ORA-03113)



 CREATE OR REPLACE PROCEDURE TEST.PR_INFO_PAYCARD
(
      vId           IN       TB_INFO_CARD.ID%TYPE default 0,
      vPayId        IN       TB_INFO_CARD.payid%TYPE,
      vAmount       IN       TB_INFO_CARD.amount%TYPE,
      vIsDetail     IN       TB_INFO_CARD.isdetail%TYPE default 0,
      oResint       OUT      int,
      oResStr       OUT      varchar2
)
IS

i int default 0;
oldIsDetail int default 0;

BEGIN

    --检测有没有重复存在
    SELECT COUNT(1) INTO i FROM TB_INFO_CARD WHERE ID!=vId AND PayId=vPayId AND Amount=vAmount;


    IF i=0 THEN

        --添加
        IF vId=0 THEN

          vId := fn_gen_id('TB_INFO_CARD'); --生成自动递增序列
          INSERT INTO TB_INFO_CARD(ID,payid,amount,isdetail) VALUES(vId,vPayId,vAmount,vIsDetail);
          COMMIT;

          oResInt := 1;
          oResStr := '新增成功';

        --修改
        ELSE

          SELECT IsDetail INTO oldIsDetail FROM TB_INFO_CARD WHERE ID=vId;
          UPDATE TB_INFO_CARD set payid=vPayId,amount=vAmount,isdetail=vIsDetail WHERE ID=vId;
          COMMIT;

          oResInt := 1;
          oResInt := '修改成功';

        END IF;

        IF vIsDetail != oldIsDetail and vIsDetail=1 THEN
          UPDATE TB_INFO_CARD SET IsDetail=0 WHERE PayId=vPayId AND ID!=vId;
          COMMIT;
        END IF;

  ELSE
    oResInt := 0;
    oResStr := '已经存在一条重复记录';
  END IF;

  EXCEPTION WHEN OTHERS THEN
       oResInt := 0;
       oResStr := '系统错误';


END PR_INFO_PAYCARD;

放到Oracle Toad执行出现红色,提示内容:ORA-03113

oracle 存储过程

冬馬かずさ 10 years, 4 months ago

Your Answer