阅读量:0
- 使用nvl函数将null替换为特定值:
SELECT name, nvl(age, 0) as age FROM employees;
- 使用nvl函数将null替换为字符串:
SELECT name, nvl(department, 'N/A') as department FROM employees;
- 使用nvl函数将null替换为另一个列的值:
SELECT name, nvl(salary, bonus) as total_compensation FROM employees;
- 使用nvl函数在条件判断中替换null:
SELECT name, CASE WHEN nvl(salary, 0) > 50000 THEN 'High' ELSE 'Low' END as salary_category FROM employees;