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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 MATLAB动图问题
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题