请高手指点:
declare
    error_xx exception;
    v_count  number;
begin
    select count(*) into v_count from sale;
    if v_count>0
          then  在这里报错    end if;
end;        

解决方案 »

  1.   

    raise_application_error('-20001','ERR');
      

  2.   

    1. test Exception
    2. raise test;
      

  3.   

    我把我的存储过程贴出来 大家看下有什么问题么! 我的PL/SQL老是提示错误“
    create or replace procedure test_exception
    declare
       test exception;
       v_con number;
    begin
      select count(*) into v_con from sale;
      if v_con>0
     then
      raise test;
      else
      insert into sale values('201101',9999.00);
      end if;
      end;
      

  4.   

     raise test还要在exception里面写抛出什么错误信息啊!
      

  5.   

    create or replace procedure test_exception
    declare
        v_con number;
    begin
      select count(*) into v_con from sale;
      if v_con>0
      then
         raise ;
      else
         insert into sale values('201101',9999.00);
      end if;
    exception
      when others then
      dbms_output.put_line('……');
    end;
      

  6.   


    您好,我刚试了下! PL/SQL提示说有语法错误,我是新手!也不清楚哪里出的错误
      

  7.   


    你都raise test了,木有异常处理模块test当然报错了……
    就好比你调用一个方法,木有这个方法。
      

  8.   

    create or replace procedure test_exception is
    v_con number;
    test exception;
    begin
    select count(*) into v_con from sale;
    if v_con > 0 then
    raise test;
    else
    insert into sale values('201101',9999.00);
    end if;
    exception
    when test then
    dbms_output.put_line('OK1');
    when others then
    dbms_output.put_line('OK2');
    end;