【发布时间】:2015-08-21 21:55:42
【问题描述】:
我想编写一个 PL/SQL 块来打印更改前后两个员工的员工编号和薪水。
请指教
cursor cur is select employees.employee_ID, employees.salary
from employees
where employees.employee_ID=&employee_ID
AND employees.salary= employees.salary
sal number;
emp_ID number(10);
introduction clob;
begin
open cur;
loop
fetch cur into sal,emp_ID;
exit when cur>=2;
introduction := ' Display the Employees_ID and Salary before and after change.';
dbms_output.put_line(introduction);
DBMS_OUTPUT.PUT_LINE('employee_id =' || emp_ID);
DBMS_OUTPUT.PUT_LINE('Salary =' || Sal);
end loop;
close cur;
END;
【问题讨论】:
-
这似乎与您所做的非常相似 in your previous question。您尝试了哪些方法,在调整时遇到了哪些问题?
-
尝试过光标,但对我来说效果不佳
-
请编辑您的问题以显示您尝试过的内容以及为什么它不起作用。如果你有错误然后显示那些,如果它给出了错误的结果显示你得到了什么和你期望什么。我们无法从头开始为您编写全部内容。
-
问题已用我的代码更新..请告知
标签: database oracle stored-procedures plsql cursor