我正在对两个表进行左外连接,其中manager_id
一个表的 可以连接到另一个表中的值employee_id
。我编写的查询运行,但我试图用nvl()
字符串“NO_MANAGER”替换空值。但是,这是我得到的:
select d.DEPARTMENT_ID, d.DEPARTMENT_NAME, nvl(d.manager_id, 0) AS MANAGER_ID, d.LOCATION_ID,
nvl(e.first_name || ' ' || e.LAST_NAME,'NO_MANAGER') AS NAME
from departments d
left join employees e on d.manager_id = e.EMPLOYEE_ID order by d.DEPARTMENT_ID;