光标错误 [英] Cursor Error

查看:73
本文介绍了光标错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

---当我运行以下代码时

---When I run following code

展开 | 选择 | Wrap | 行号

推荐答案


---当我运行以下代码


DECLARE

v_evct NUMBER(20);

v_evcd NUMBER(20);

v_class VARCHAR2(100);

光标c1从input_info中选择*;

BEGIN

FOR c1中的r1

LOOP

SELECT sum(EV_COST),EV_ID,EV_ATTR INTO

v _evct,v_evcd,v_class

FROM cost_test GROUP BY EV_ID,EV_ATTR;

END LOOP;

END;


- 我收到此错误

第1行的错误:

ORA-01422:确切的提取返回超过请求的行数

ORA-06512:第9行


- 请告诉我如何避免上述错误
---When I run following code

DECLARE
v_evct NUMBER(20);
v_evcd NUMBER(20);
v_class VARCHAR2(100);
cursor c1 is select * from input_info;
BEGIN
FOR r1 in c1
LOOP
SELECT sum(EV_COST),EV_ID,EV_ATTR INTO
v_evct,v_evcd,v_class
FROM cost_test GROUP BY EV_ID,EV_ATTR ;
END LOOP;
END ;

--I got this error
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 9

--cud u please tell me how to avoid this above error



请将您发布的代码附在[code]标签中(请参阅如何提问)。


这使我们的专家更容易阅读和理解它。如果不这样做会给版主带来额外的工作,从而浪费资源,否则可以回答会员的问题。


请将来使用[code]标签。


我记得这是我第三次为你做这件事你之前已经被告知使用CODE标签。


MODERATOR

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members'' questions.

Please use [code] tags in future.

I remember this is third time I am doing it for you and you have been already informed before to use CODE tags.

MODERATOR



---当我运行以下代码时

---When I run following code

展开 | 选择 | 换行 | 行号


感谢您的回复

Thanks for ur reply

展开 | 选择 | Wrap | 行号


这篇关于光标错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆