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

来源:互联网 发布:帝国时代2mac版 编辑:程序博客网 时间:2024/04/29 15:21
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;
0 0