写一个存储过程,使employee(name,age,emp_no,salary)表中的salary值在0-1000之间的员工的工资上涨20%,(提示:要求用到游标)

存储过程的应用,如何既有输入又有输出?

Create procedure pro_name

(xxxx in/out type;

yyyy in/out/inout type;

) is/as

zzzz type;

begin

sqlpro;

exception

exceptionxxxxx;

commit;

end;

写一个存储过程,使employee(name,age,emp_no,salary)表中的salary值在0-1000之间的员工的工资上涨20%,(提示:要求用到游标)

Cteate or replace procedure emp_sal

V_name employee.name%type;

V_emp_no employee.emp_no%type;

V_salary employee.salary%type;

Cursor cursor_sal is

       Select name,emp_no,salary from employee where salary between 0 and 1000;

Begin

       Open cursor_sal;

      Loop

              Fetch cursor_sal into v_name,v_emp_no,v_salary;

              Exit when cursor_sal%notfound;

              Update employee set salary=salary*1.2 where name=v_name and emp_no=v_emp_no;

       End loop;

       Close cursor_sal;

       Commit;

End;

如何判断游标是否到了末尾?(提示:用%notfound)

cursor_name%notfound

posted @ 2012-10-23 11:29  邹晟  阅读(3813)  评论(0编辑  收藏  举报