2013-05-16 41 views
0

我无法处理异常的案例statment,对于〔实施例PL/SQL:在Case语句

Case when someiput is null then 

    select something from sometable where somecondition=somevalue 
     Exception 
     when NO_DATA_FOUND then 
      someinput:=somevalue 
     end; 
     end case ; 

埃罗我得到的是Encountere异常expeting情况下开始处理异常声明

所以任何人都可以你请让我知道如何处理this.THis正在发生的是甲骨文11g 可以很容易重现在其他版本以及

回答

3

你是在谈论QUERY或PLSQL的案例陈述?在PLSQL中,您可以在case语句中编写Begin,Exception和End块。像,

Case 
when someiput is null then 

    Begin 
    select something into val 
     from sometable 
    where somecondition = somevalue; 

    Exception when NO_DATA_FOUND then 
    someinput := somevalue; 
    end; 
end case; 

我希望它有帮助!

+2

@ashwin - 这是答案。你的proc错过了'BEGIN'去与'EXCEPTION'一起去。 –