---pl/sql简单存储过程
--编写一个过程,可以输入一个雇员名,如果该雇员的补助不是0,就加100,
--如果补助为0,就把补助为0的设置为200
create or replace procedure update_comm(name_in in varchar2) is
v_comm emp.comm%type;
begin
select comm into v_comm from emp where ename = name_in;
---判断值是否为null
if v_comm is null then
update emp set comm=200 where ename=name_in;
else
update emp set comm=comm+100 where ename=name_in;
end if;
end;
--编写一个过程,可以输入一个雇员名,如果该雇员的补助不是0,就加100,
--如果补助为0,就把补助为0的设置为200
create or replace procedure update_comm(name_in in varchar2) is
v_comm emp.comm%type;
begin
select comm into v_comm from emp where ename = name_in;
---判断值是否为null
if v_comm is null then
update emp set comm=200 where ename=name_in;
else
update emp set comm=comm+100 where ename=name_in;
end if;
end;