create or replace procedure proc_show_emp(p_deptno employees.departmentid%type) as
v_sal employees.salary%type;
begin
select avg(salary)
into v_sal
from employees
where departmentid = p_deptno;
dbms_output.put_line(p_deptno || ' ' || v_sal);
for v_emp in (select *
from employees
where departmentid = p_deptno
and salary > v_sal) loop
dbms_output.put_line(v_emp.employeeid || ' ' || v_emp.lastname);
end loop;
exception
when no_data_found then
dbms_output.put_line('then department dot''t exists');
end proc_show_emp;
v_sal employees.salary%type;
begin
select avg(salary)
into v_sal
from employees
where departmentid = p_deptno;
dbms_output.put_line(p_deptno || ' ' || v_sal);
for v_emp in (select *
from employees
where departmentid = p_deptno
and salary > v_sal) loop
dbms_output.put_line(v_emp.employeeid || ' ' || v_emp.lastname);
end loop;
exception
when no_data_found then
dbms_output.put_line('then department dot''t exists');
end proc_show_emp;