create or replace procedure PRO_QUERY_DEPT(
P_DEPTNO in dept.deptno%type,
P_DNAME out dept.dname%type
)
as
begin
select dname into P_DNAME from dept where
deptno = P_DEPTNO;
if P_DNAME = 'SALES' then
P_DNAME :='销售部门';
else
P_DNAME :='其它部门';
end if;
dbms_output.put_line(P_DNAME);
exception
when others then
dbms_output.put_line(sqlcode||sqlerrm);
end;