oracle.中PL/SQL的编程解答一个题目.!

[复制链接]
查看11 | 回复2 | 2009-7-3 16:06:43 | 显示全部楼层 |阅读模式
declare
--定义游标;
cursor c is select id,(SAL*0.3) sal,sal from Emplyoe for update;
id number;
sal number;
sal2 number; BEGIN
open c;
loop
fetch c into id,sal,sal2;
exit when c%notfound;
if sal2>=1000 then
...
回复

使用道具 举报

千问 | 2009-7-3 16:06:43 | 显示全部楼层
把 exit when c%notfound;放到fetch c into id,sal,sal2;之后。即:fetch c into id,sal,sal2;exit when c%notfound; 重复的原因是id,sal,sal2;保存了最后一条记录的值。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行