【发布时间】:2016-12-15 04:52:07
【问题描述】:
我的存储过程存在一些问题。如果你能帮助我,那就太好了。谢谢!
Create or replace procedure final(Minimum in number)
is
Cursor salary_cursor(Minimum_salary number) is
select first_name || ' ' || last_name employee, department_name, job_title,
min_salary, salary from employees
join departments using (department_id)
join jobs using (job_id)
where Minimum_salary <= min_salary;
begin
for x in salary_cursor(Minimum) loop
insert into finalrept values(n.Employee_name, n.department_name, n.job_title,
n.min_salary, n.salary);
end loop;
Exception
when others then
dbms_output.put_line(SQLERRM || ', ' || SQLCODE);
end final;
/
sho err
我似乎无法弄清楚为什么会出现这些错误!任何帮助表示赞赏。
【问题讨论】:
-
删除
WHEN OTHERS异常块,它隐藏了实际的错误和行号。作为一种良好的编码实践,它本身被认为是一个错误。见WHEN OTHERS – A bug -
将 n. s 替换为 x.
-
为什么采用这种缓慢的逐行游标方法?整个过程可以用单个
insert语句替换。无需 PL/SQL
标签: sql oracle stored-procedures plsql