oracle 的存储过程if怎么嵌套啊?

想实现switch 类似的功能

我给你举个例子:
--配送量(万箱)
select sum(QUANTITY_SUM) into quantity_sum from DWV_OUT_DIST_BILL where to_char(DIST_DATE,'YYYYMM')=month ;
if quantity_sum is null then
quantity_sum:=0;
end if;
--转换成万箱
quantity_sum :=quantity_sum/50/10000;
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-12-27
case when a=‘a’ then a=‘a’;
when b='b' then b='b';
... ...
when others then xxx;
end case;
以上就是oracle的开关语句。不过你的oracle版本貌似得是9i以上的哦
第2个回答  2009-12-21
可以用CASE来实现类似的SWITCH
例:
update lyn.e set name= case
when id=124 then 'LYN'
when id=154 then 'CAY'
when id=554 then 'DAY'
else name
end