首页 > Linux操作系统 > Linux操作系统 > 使用多从条件判断时要特别注意!
当v_j=1时答案是多少?10还是110?
不用做试验,凭直观感觉:)
当然出现这样的判断程序逻辑可能存在问题!
declare
v_i int default 10 ;
v_j int :=&a ;
v_result number ;
begin
if v_j>0 then
v_result := v_i/v_j ;
elsif v_j = 1 then
v_result := v_i + 100;
elsif v_j = 0 then
v_result := -1 ;
end if ;
dbms_output.put_line(v_result) ;
end;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19602/viewspace-61749/,如需转载,请注明出处,否则将追究法律责任。