您的位置:首页 > 其它

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

2012-10-23 11:29 2683 查看
存储过程的应用,如何既有输入又有输出?

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐