when others then
    null;

解决方案 »

  1.   

    others 可以捕捉前面所有没有抛出的异常
      

  2.   

    小弟不太明白,请各位以下面的触发器为例子帮小弟改改,谢谢!begin
      -- 检查用户ID是否存在
      if not UserID_Exists(:new.userid) then
          raise_application_error(-20000, "用户ID不存在");
      end if;
      
      :new.ID := get_id_counter('usemodule');
    end usemodule_trig;
      

  3.   

    begin
      -- 检查用户ID是否存在
      if not UserID_Exists(:new.userid) then
          raise_application_error(-20000, "用户ID不存在");
      end if;
      
      :new.ID := get_id_counter('usemodule');
    exception
      when others then
        ……
    end usemodule_trig;
    这样试试
      

  4.   

    cyrano 不是为了解决问题,连引发问题的功能都不要了吗。其实错误信息是个错误栈,里面有从直接引发 error 到最上层调用代码间整个调用层次的错误,您是无法避免的,如果您是不想要 client 端弹出整个错误栈的话,您可以在 java 程序中捕获错误,并使用自己的错误提示,或纸打印错误栈中某条(某调用级的错误),这在 jdbc for oracle 中是可以做到的,请查看您的 jdbc for oracle 的文档。