更好的方式来构造一个PL / SQL IF THEN语句? [英] Better way to structure a PL/SQL IF THEN statement?
本文介绍了更好的方式来构造一个PL / SQL IF THEN语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只是想知道是否有更好的方法在ORACLE中编写以下PL / SQL代码片段。
IF p_c_courtesies_cd不为null
或p_c_language_cd不为null
或v_c_name不为null
或v_c_firstname不为null
或v_c_function不为null
或p_c_phone不为null
OR p_c_mobile不为null
或p_c_fax不为null
或v_c_email不为null
)THEN
- 做某事
END IF;
解决方案
如果coalesce (expr1,expr2,... expr_n)不为null,那么do something end if;
(感谢Tony的更正)
Just wondering if there is a better way to write the following PL/SQL piece of code in ORACLE ?
IF(p_c_courtesies_cd is not null OR p_c_language_cd is not null OR v_c_name is not null OR v_c_firstname is not null OR v_c_function is not null OR p_c_phone is not null OR p_c_mobile is not null OR p_c_fax is not null OR v_c_email is not null ) THEN -- Do something END IF;
解决方案If coalesce( expr1, expr2, ... expr_n ) is not null then do something end if;
(Thanks Tony for the correction)
这篇关于更好的方式来构造一个PL / SQL IF THEN语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文