
Using the Function NVL
DECLARE
the_manager employees.manager_id%TYPE;
NAME employees.last_name%TYPE;
BEGIN
-- NULL is a valid argument to NVL. In this case, manager_id is null
-- and the NVL function returns -1.
SELECT Nvl(manager_id,-1),
last_name
INTO the_manager,NAME
FROM employees
WHERE employee_id = 100;
dbms_output.Put_line(NAME
||' is managed by employee Id: '
||the_manager);
END;
/

0 comments:
Post a Comment