Oracle中nvl(expr1,expr2)用法

nvl(expr1,expr2):如果expr1不为空,则选expr1,如果expr1为空,则选expr2的值
例如:
table tb_source:
在这里插入图片描述

select nvl(source_name, type) from tb_source where source_id = 1

在这里插入图片描述

select nvl(source_name, type) from tb_source where source_id = 2

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_40626699/article/details/85262932