游标错误1 [英] cursor error1
本文介绍了游标错误1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个表emp和dept。
Dept表有一列名为depno,值为10,30,40。
我使用了以下查询
I have two tables emp and dept .
Dept table has one column called depno and the values are 10,30,40.
I have used following query
展开 | 选择 | Wrap | 行号
推荐答案
我有两个表emp和dept。
Dept表有一列名为depno,值为10,30,40。
我用过以下查询
声明
v_empno数字;
v_ename name;
v_sal;
游标c1是从dept中选择deptno;
开始
$ c $ b for r1 in c1
loop
select empno,ename,sal into v_empno,v_ename,v_sal来自emp
其中deptno = r.deptno;
结束循环;
结束;
/
但我收到的误差低于
ORA-01422:确切的提取返回超过请求的行数
cud u请指教。
谢谢
I have two tables emp and dept .
Dept table has one column called depno and the values are 10,30,40.
I have used following query
Declare
v_empno number ;
v_ename name;
v_sal ;
cursor c1 is select deptno from dept ;
begin
for r1 in c1
loop
select empno,ename,sal into v_empno,v_ename,v_sal from emp
where deptno=r.deptno;
end loop;
end;
/
but i am getting below error as
ORA-01422: exact fetch returns more than requested number of rows
cud u please advice .
Thanks
hai,
我们只能传递INTO条款中的sigle值但是deptno有更多的列。
请尝试这个查询。
光标c1是
选择
empno,ename,sal
来自emp,dept
其中deptno = deptno;
hai,
we can only pass the sigle value from the INTO clause but the deptno have a morethan number of columns .
plz try this query.
cursor c1 is
select
empno,ename,sal
from emp ,dept
where deptno=deptno;
它不工作... cud u plz发给我解决方案plz
its not working ... cud u plz send me the solution plz
展开 | 选择 | Wrap | 行号
这篇关于游标错误1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文