a3804997 2016-04-18 06:44
浏览 1697

oracle我是哪里的类型不匹配?

以下是代码!
1 declare
2 type empcursor is ref cursor;
3 emp1 empcursor;
4 avgSal number;
5 deptno number;
6 empid number;
7 empSalary number;
8 begin
9 deptno:=&deptno;
10 if deptno=2 then
11 select avg(salary) into avgSal from emp where dept=2;
12 open emp1 for select id salary from emp where dept=2;
13 loop
14 fetch emp1 into empid,empSalary;
15 exit when emp1%notfound;
16 if empSalary>avgSal then
17 update emp set salary=salary-100 where id=empid;
18 elsif empSalary 19 update emp set salary=salary+100 where id=empid;
20 end if;
21 end loop;
22 if deptno=3 then
23 select avg(salary) into avgSal from emp where dept=3;
24 open emp1 for select id salary from emp where dept=3;
25 loop
26 fetch emp1 into empid,empSalary;
27 exit when emp1%notfound;
28 if empSalary>avgSal then
29 update emp set salary=salary-100 where id=empid;
30 elsif empSalary 31 update emp set salary=salary+100 where id=empid;
32 end if;
33 end loop;
34 end if;
35 end if;
36* end;
QL> /
输入 deptno 的值: 2
原值 9: deptno:=&deptno;
新值 9: deptno:=2;
eclare

第 1 行出现错误:
RA-06504: PL/SQL: 结果集变量或查询的返回类型不匹配
RA-06512: 在 line 14

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 树莓派安卓APK系统签名
    • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
    • ¥65 汇编语言除法溢出问题
    • ¥15 Visual Studio问题
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗