Home  >  Article  >  Database  >  Oracle中的nvl函数

Oracle中的nvl函数

WBOY
WBOYOriginal
2016-06-07 17:20:562028browse

若e1的计算结果为null值则返回e2。若e1的计算结果不是null值,则返回e1。若e1与e2的均为null值,则返回NULL。

功能

从两个表达式返回一个非 null 值。

语法

NVL(eExpression1, eExpression2)

参数

eExpression1(e1), eExpression2(e2)两个参数可以是任意一种数据类型

若e1的计算结果为null值则返回e2。若e1的计算结果不是null值,则返回e1。若e1与e2的均为null值,,则返回NULL。

返回值类型

字符型、日期型、日期时间型、数值型、货币型、逻辑型或 null 值

说明

在不支持null值或null值无关紧要的情况下,可以使用 NVL() 来移去计算或操作中的null值。

select nvl(a.name,'空的') as name from student a join school b on a.ID=b.ID

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn