/*
给指定的员工涨100的工资,并打印涨前和涨后的薪水
create [or replace] PROCEDURE 过程名(参数列表)
AS
PLSQL子程序体;
SQL> begin
2 raiseSalary(7839);
3 raiseSalary(7566);
4 commit;
5 end;
6 /
涨前:7986 涨后:8086
涨前:5024.53 涨后:5124.53
PL/SQL 过程已成功完成。
*/
create or replace procedure raiseSalary(eno in number)
as
–变量
psal emp.sal%type;
begin
–得到涨前薪水
select sal into psal from emp where empno=eno;
–涨工资
update emp set sal=sal+100 where empno=eno;
–问题:要不要commit??
–打印
dbms_output.put_line(‘涨前:’||psal||’ 涨后:’||(psal+100));
end;
/