创建存储过程,以部门编号为参数返回该部门的人数及平均工资(返回一个值可以通过函数来实现,但如果要返回多个值,需要使用out或in out模式参数实现)

create or replace procedure proc_return_deptinfo(p_deptno employees.departmentid%type,

                                                 p_avgsal out employees.salary%type,
                                                 p_count  out number) as

begin
  select avg(salary), count(*)
    into p_avgsal, p_count
    from employees
   where departmentid = p_deptno;

exception
  when no_data_found then
    dbms_output.put_line('then department dot''t exists');
 
end proc_return_deptinfo;
展开阅读全文

没有更多推荐了,返回首页