写一个存储过程,使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
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
相关文章推荐
- .使用面向对象思想,输出员工信息并计算员工的工资。实现过程为:定义一个部门(Department)类,该类有部门编号(Id)、部门名称(Name)属性; 再定义一个员工(Employee)类,该类的属
- 对工资在1000到2000元之间的员工更感兴趣,要求工资在这个范围员工排序在前面
- 编写一个Java程序,在程序中包含一个Employee类,Employee类包含name、age、salary三个成员变量
- JDBC:将员工表(Employee)中的员工姓名(empName)逐个显示在一个JComboBox中
- 《数据库SQL实战》获取当前(to_date='9999-01-01')薪水第二多的员工的emp_no以及其对应的薪水salary
- 用两个线程玩猜数字游戏,第一个线程负责随机给出1~100之间的一个整数,第二个线程负责猜出这个数。要求每当第二个线程给出自己的猜测后,第一个线程都会提示“猜小了”、“猜大了”或“猜对
- 编写一个函数,在页面上输出1~1000之间所有能同时被3,5,7整除的证书,并要求每行显示6个这样的数
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和setA
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ).
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和setA
- /*编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和se
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ).
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和setA
- 建一个学生表,其中有 no ,name ,address,age,enterdate 5个字段
- 查找所有员工入职时候的薪水给出emp_no以及salary并按照emp_no进行逆序
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和setA
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和setA
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age
- 编写一个学生类Students,该类成员变量包括学号no、姓名name、性别sex和年龄age,该类的成员方法有genNo()getName ). * getSex().getAge().和setA
- 用两个线程玩猜数字游戏,第一个线程负责随机给出1~100之间的一个整数,第二个线程负责猜出这个数。要求每当第二个线程给出自己的猜测后,第一个线程都会提示“猜小了”、“猜大了”或“猜对