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;
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;
本文介绍了一个PL/SQL过程的实现,该过程用于查询指定部门的员工平均薪资及人数。通过使用OUT参数返回查询结果,此过程展示了如何在Oracle数据库中进行基本的数据检索操作。
4614

被折叠的 条评论
为什么被折叠?



