【发布时间】:2015-10-27 22:05:08
【问题描述】:
对于这个特定的区块,我不断得到
ora 0142 : 精确提取返回的行数超过了请求的行数
,我尝试过 distinct、rank 和 rownum,但似乎没有任何效果。
begin
for i in c1 loop
if i.estacao_a2 is not null then
begin
select migrationidentifier
into v_master_location
from (
select com.migrationidentifier
, row_number () over (partition by com.migrationidentifier order by com.migrationidentifier asc) RK
from com_location com
where round (i.latitude_a_decimal, 1) =
round (com.LATITUDEWGS84, 1)
and round (i.longitude_a_decimal, 1) =
round (com.longitudewgs84, 1)
and com.sourcedomain = 'FENIX'
)
where rk=1
;
exception
when no_data_found
then dbms_output.put_line ( 'NO RECORDS FOUND IN COM_LOCATION FOR LATITUDE:' || i.latitude_a_decimal);
end;
end if;
end loop;
end;
【问题讨论】:
-
你把
distinct关键字放在哪里了? -
这只是意味着您有多个用于 where 子句中的 latitude_a_decimal 和 longitude_a_decimal 值的 migrationidentifier 值。
-
嗨,collapser,我之前使用过下面提到的查询,但得到相同的错误 select distinct com.migrationidentifier into v_master_location from com_location com where round (i.latitude_a_decimal, 1) = round (com.latitudewgs84, 1) and round (i.longitude_a_decimal, 1) = round (com.longitudewgs84, 1) and com.sourcedomain = 'FENIX';
-
嗨迈克尔如果我运行查询,我会得到想要的结果。在我在这里运行的脚本中同样不起作用。
-
在该循环中的某处必须有一个值组合会引发错误。捕获 too_many_rows 异常并输出值以查看它们是什么。