运行脚本时Sql Developer查询错误 [英] Sql developer query error when running the script

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

问题描述

 DECLARE 
testID number(6);
testRevID number(6);
LDescription varchar2(100):='奥马哈:确保Y-D电路2A压缩机夹具移除测试-4 comp';

BEGIN

SELECT tl.TESTID INTO testID FROM TESTLIB tl
WHERE tl.DBDESCRIPTION = LDescription;

SELECT tlv.testrevid INTO testRevID FROM TESTLIBREVISION tlv
其中tlv.revision = 2和tlv.testid = testID;

dbms_output.put_line(testID);
dbms_output.put_line(testRevID);

END;





当我在SQL Developer中运行查询时,我收到以下错误:

错误报告:
ORA-01422:精确提取返回超过请求的行数
ORA-06512:第11行
01422. 00000 - 确切提取返回超过请求的数量行
*原因:精确提取中指定的数量小于返回的行数。
*操作:重写查询或更改请求的行数







任何人都可以告诉我上面的查询有什么问题..感谢任何帮助。



提前致谢。



我尝试了什么:



 SELECT tlv.testrevid FROM TESTLIBREVISION tlv 
其中tlv.revision = 2和tlv.testid = 1604;

dbms_output.put_line(testrevid);





但是当我运行上面的脚本时,我得到单值。

解决方案

< blockquote>问题肯定只是由于select查询返回了多行。



请检查其他值。只是尝试找到重复的值

DECLARE 
 testID number(6); 
 testRevID number(6);
 LDescription varchar2(100) := 'Omaha : Ensuring Y-D Circuit 2A compressor Fixture Removed test -4 comp';

BEGIN

SELECT tl.TESTID INTO testID FROM TESTLIB tl
WHERE tl.DBDESCRIPTION = LDescription; 
  
SELECT tlv.testrevid INTO testRevID FROM TESTLIBREVISION tlv
where tlv.revision = 2 and tlv.testid = testID;

dbms_output.put_line(testID); 
dbms_output.put_line(testRevID); 
  
END; 



I get the following error, when i run the query in SQL Developer:

Error report:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 11
01422. 00000 -  "exact fetch returns more than requested number of rows"
*Cause:    The number specified in exact fetch is less than the rows returned.
*Action:   Rewrite the query or change number of rows requested




Can anybody tell me what is wrong with the above query.. Any help appreciated.

Thanks in advance.

What I have tried:

SELECT tlv.testrevid FROM TESTLIBREVISION tlv
where tlv.revision = 2 and tlv.testid = 1604;

dbms_output.put_line(testrevid); 



But when i run the above script i get single value.

解决方案

The problem is definitely only due to the select query returning more than one rows.

plese check for other values. just try to find duplicate values


这篇关于运行脚本时Sql Developer查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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