plsql存储过程中的条件判断

在PLSQL中,我写了一个存储过程 里面定义了一个入参 product_type,在程序beging之后我想做个判断,就是限制product_type的入参值 ,只能为 1 ,2, 3 如果不是这三个值则 程序不继续执行 怎么写判断语句?

这样写就行了。如果比是1,2,3,就return返回。
if product_type not in (1, 2, 3) then
return;
end if;
如果product_type是字符串变量:
if product_type not in ('1', '2', '3') then
return;
end if;
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-11-29
if product_type = 1 or product_type = 2 or product_type = 3 then
--要执行的代码

else

end if;