我發現了一個錯誤,我不知道爲什麼:PL/SQL:數字或值錯誤
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.STANDARD", line 394
ORA-06512: at "DOMINOS.DISTANCE", line 10
ORA-06512: at "DOMINOS.ZOEKWINKELVOORADRES", line 19
ORA-06512: at line 5
光標應該包含145行。當我執行該過程時,我在54行之後得到上面的錯誤消息。
create or replace procedure zoekWinkelVoorAdres
(v_postcode in postcode.postcode%type,
v_huisnr in WINKEL.HUISNR%type,
v_id out WINKEL.ID%type,
v_afstand out number)
is
type lat_array is varray(100000) of POSTCODE.LAT%type;
type lon_array is varray(100000) of POSTCODE.LON%type;
type id_array is varray(100000) of winkel.id%type;
a_lat lat_array;
a_lon lon_array;
a_id id_array;
latwin postcode.lat%type;
lonwin postcode.lon%type;
latklant postcode.lat%type;
lonklant postcode.lon%type;
vafstand number(38);
cursor winkelafstand is
select w.ID, p.lat, p.lon
from winkel w
join postcode p
on w.POSTCODE_ID_FK = p.POSTCODE_ID;
begin
select lat, lon into latklant,lonklant
from postcode
where postcode = v_postcode;
open winkelafstand;
fetch winkelafstand bulk collect into a_id, a_lat, a_lon;
close winkelafstand;
for i in a_lat.first..a_lat.last loop
vafstand := distance(a_lat(i),a_lon(i),latklant,lonklant);
dbms_output.put_line(vafstand || ' ' || a_id(i));
insert into winkel_afstand
(Winkel_ID, afstand) values(a_id(i),vafstand);
end loop;
end;
/
一般問題由您的代碼處理的數據集中的數據導致的數據類型不適合所使用的數據類型。字符串可能太長,或者您將非數字數據視爲數字,即oracle無法將數據轉換爲數字。 – user2672165