sql中有系统变量@@error如下sqlif @@error <> 0   
begin   
  raiserror 50001 '更新失败!'   
  return   
end   如何改成oracle代码

解决方案 »

  1.   

    if sql%rowcount<=0 then
    raise_applycation_error(-20001,'更新失败!');
    return null;
    end if;
      

  2.   


    if sql%rowcount != 0  then 
       begin   
            raise_application_error(-20001, '更新失败!') ;  
            return null;  
       end ;
    end if;  
      

  3.   

    错了,是sql%rowcount == 0
      

  4.   


    begin
        update emp1 SET ename='adada' WHERE empno=1234;
        if sql%rowcount = 0  then 
            raise_application_error(-20001, '更新失败!') ;  
            return null;  
        end if;
    end ;  
      

  5.   


    begin
        update emp1 SET ename='adada' WHERE empno=1234;
        if sql%rowcount = 0  then 
            raise_application_error(-20001, '更新失败!') ;  
            --return null;  
        end if;
    end ; ORA-20001: 更新失败!
    ORA-06512: 在 line 4Total execution time 0.015 sec.            
      

  6.   

    begin
       if sql%rowcount<= 0 then
          raise_application_errot(-20001,'更新失败!');
        end if
    end