19PL_SQL过程之创建存储过程

来源:互联网 发布:免费tk域名注册的网站 编辑:程序博客网 时间:2024/05/24 05:34
create or replace procedure proc1
is
  cursor c is
    select * from emp for update;
begin
  for v_emp in c loop
    if(v_emp.deptno=10) then
       update emp set sal=sal+10 where current of c;
    elsif(v_emp.deptno=20) then
       update emp set sal=sal+20 where current of c;
    else
       update emp set sal=sal+50 where current of c;
    end if;
  end loop;
  commit;
end;


存储过程创建以后又两种执行方式
exec proc1;


begin
  proc1;
end;
0 0
原创粉丝点击