对不起,我说错了,不是函数是过程,过程很简单,就是:
procedure disp_msg(in_mesg VARCHAR2) IS   
begin
  --    
  raise_application_error('-20000','E: '||in_mesg);   
  --
end;

解决方案 »

  1.   

    这么简单不用过程了,直接raise_application_error就行了IF  DEL_BZ <> 1 then 
       raise_application_error( -20000, '不允许删除此记录');
       RETURN;
    END IF;
      

  2.   

    re: beckhambobo(beckham) 
    re: LGQDUCKY(飘)
    直接写到触发器里是一回事啊,出错的时候,还是会显示那些除了有用的出错的提示以外的信息代码和其他不必要的字符。我想用raise_application_error可能不能解决问题,还有没有别的办法。
      

  3.   

    BEGIN 
    SELECT ....;
    EXCEPTION
    when no_data_found then 
      RAISE_APPLICATION_ERROR( -20054, '没有找到该报表位置('|| my_bmbh ||')' ); when others then 
    RAISE_APPLICATION_ERROR( -20052, SQLERRM );
    END ;
      

  4.   

    exception
    when others then
    .....
    end;
    /