The NVL function substitutes an alternate value for a NULL value.


NVL( Arg1, replace_with )
Both the parameters are mandatory. Note that NVL function works with all types of data types. And also that the data type of original string and the replacement must be in compatible state i.e. either same or implicitly convertible by Oracle.
The SELECT statement below will display 'n/a' if an employee has been not assigned to any job yet i.e. JOB_ID is NULL. Otherwise, it would display the actual JOB_ID value.
SELECT  first_name, NVL(JOB_ID, 'n/a')
FROM employees;
Read more: Conv. Func.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
сниппеты с SQL
Зарегистрируйся сейчас
или Подпишись на будущие тесты