create or replace function get_salary( dept_no number, emp_count number) return number is v_sum number; begin select sum(salary),count(*) into v_sum, emp_count from employees where employees_id > dept_no; return v_sum; exception when no_data_found then dbms_output.put_line('the date you need is not exist'); when too_many_rows then dbms_output.put_line('program error,please use cousor'); when others then dbms_output.put_line('other errors'); end get_salary;
create or replace function get_salary(
dept_no number)
return number is
v_sum number;
emp_count NUMBER;
begin
select sum(salary),count(*) into v_sum, emp_count
from employees where employees_id > dept_no;
return v_sum;
exception
when no_data_found then
dbms_output.put_line('the date you need is not exist');
when too_many_rows then
dbms_output.put_line('program error,please use cousor');
when others then
dbms_output.put_line('other errors');
end get_salary;