此功能检查所有员工的工资是否在正确的最高和最低工资范围之间。我想更新它,以便它返回工资超出范围的员工 ID ?? 我尝试定义一个集合,但它一直给我错误。有任何想法吗 ??
create or replace function min_max return number as
cursor job_cur is
select job_id, min_salary, max_salary from jobs;
cursor emp_cur(p_job_id jobs.job_id%type) is
select employee_id, salary from employees where job_id = p_job_id;
Type id_table is table of number index by binary_integer;
return_id id_table;
i number := 1;
begin
for job_rec in job_cur loop
for emp_rec in emp_cur(job_rec.job_id) loop
if (emp_rec.salary > job_rec.max_salary)
or (emp_rec.salary < job_rec.min_salary) then
--return 0;
return_id(i).emlpoyee_id := emp_rec.employee_id; // error here
i := i+1;
end if;
end loop;
end loop;
--return 1;
return return_id; // error here
end min_max;
这是更新的代码,但它不起作用。错误:错误(15,17):PL/SQL:语句被忽略。错误(15,30):PLS-00487:对变量“NUMBER”的引用无效。错误(21,5):PL/SQL:语句被忽略。错误(21,12):PLS-00382:表达式类型错误。