I'm doing a left outer join of two tables where the manager_id
of one table can be joined to values in another table's employee_id
. The query I wrote runs, but I am trying to use nvl()
to replace the null values with the string 'NO_MANAGER'. However, this is what I get instead:
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;
This is what is returned:
Am I missing something or will nvl()
not work in this case?