我收到一个错误,我不知道为什么:
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;
/