--사원번호를 입력받아 사원번호, 사원명, 부서명
--10: 회계부, 20:기획부, 30:인사부 40총괄부
create or replace procedure emp_search(p_empno in emp.empno%type)
is
s_deptno emp.deptno%type;
s_ename emp.ename%type;
s_dname varchar2(20);
begin
select ename, deptno into s_ename, s_deptno from emp where empno=p_empno;
--7499
if s_deptno=10 then
s_dname := '회계부';
elsif s_deptno=20 then
s_dname := '기획부';
elsif s_deptno=30 then
s_dname := '인사부';
elsif s_deptno=40 then
s_dname := '총괄부';
else
s_dname := '해당 부서가 없습니다.';
end if;
dbms_output.put_line(p_empno||', '||s_ename||', '||s_deptno||', '||s_dname);
end;
set serveroutput on;
execute emp_search(7499);
최근댓글