我写完之后执行sql,跑存储的时候会报数据未找到错误,后来我加上 exception when no_data_found then sal := 1;没有报错了,但是在命令里面执行成功之后没有打印除结构
create or replace procedure salarys(egh in number)
as
--定义一个变量保存涨前薪水
sal emp.salary%type;
begin
--得到员工涨前的薪水
select salary into sal from emp where employee = egh;
exception
when no_data_found then
sal := 1;
--给该员工涨100
update emp set salary = salary+100 where employee = egh;
--打印
dbms_output.put_line('涨前:'||sal||'涨后:'||(sal+100));
end;
/