I am attempting to create a function (at the database level) that is to be called from a web map. The function is to enable that when a user clicks on a point the associated region (polygon) is also selected/highlighted. Points and regions are associated at the attribute level via the value in a column called code
(eks. not spatially).
I have created the below code but it returns the error:
ORA-00932: inconsistent datatypes: expected CHAR MDSYS.SDO_GEOMETRY (?)
Code:
create or replace function region_select
(
p_geom in sdo_geometry
)
RETURN SDO_GEOMETRY
DETERMINISTIC
IS
v_pointId number;
v_code number;
geom_out sdo_geometry;
BEGIN
select point_id into v_pointId from points where geom = p_geom;
select code into v_code from points where point_id = v_pointId;
if (v_pointId is not null)
then
select geom into geom_out from regions where code = v_code;
RETURN geom_out;
end if;
-- error handling
exception
when others then
raise_application_error(-20001,'An error was encountered - '||
sqlcode ||' -error- '|| sqlerrm);
rollback;
end;
geom_out
always just going to be the same asp_geom
with the queries you're using? – Alex Poole