我正在编写一个 APEX 应用程序,它利用空间通过 Googlemaps API 进行邻近搜索,我已经构建了该函数并且它编译得很好,但是每当我尝试在 SQLDeveloper 中运行它时,我都会收到错误消息not enough arguments
。
我创建的用于设置新纬度/经度点的函数从我的stores
表中输入一个邮政编码,然后它使用 Google 地图 API 返回该邮政编码的长纬度坐标,返回时构建一个SDO_GEOMETRY
对象,该对象被返回并设置在表格的一location
列中stores
。
功能代码:
CREATE OR REPLACE FUNCTION set_spatial_point
(
-- Only accept postcodes from the store table
p_postcode stores.postcode%TYPE
)
RETURN MDSYS.SDO_GEOMETRY
IS
-- Build local variables
l_lng VARCHAR2(100);
l_lat VARCHAR2(100);
n_spatial_object MDSYS.SDO_GEOMETRY;
BEGIN
-- Populate long and lat parameters
POSTCODE_TO_LAT_LNG_GM_API(p_postcode, l_lat, l_lng);
-- Populate the new spatial object
n_spatial_object := MDSYS.SDO_GEOMETRY
(
-- use 01 as we wish to add the point to the map
2001,
-- SRID for WGS84 longitutde/latitude format
8307,
-- Set the information of the point ( we don't need a Z co-ord )
SDO_POINT_TYPE
(
l_lng,
l_lat,
null
),
null, -- We have no SDO_ELEM_INFO_ARRAY
null -- We have no SDO_ORDINATE_ARRAY
);
-- Return the new spatial object
dbms_output.put_line('sdo_gtype='||n_spatial_object.sdo_gtype);
dbms_output.put_line('first element from sdo_ordinates='||n_spatial_object.sdo_ordinates(1));
RETURN n_spatial_object;
END set_spatial_point;
为什么我得到参数不足错误,即使我用有效的调用它stores.postcode%TYPE
,(我已经尝试更改为,VARCHAR2
但这没有任何区别。)
编辑:创建函数后,我调用该方法:
DECLARE
my_object MDSYS.SDO_GEOMETRY;
BEGIN
my_object := set_spatial_value('MK80PB');
END;
我现在收到以下错误:
Error starting at line : 1 in command -
DECLARE
my_object MDSYS.SDO_GEOMETRY;
BEGIN
my_object := set_spatial_value('MK80PB');
END;
Error report -
ORA-06550: line 4, column 14:
PLS-00201: identifier 'SET_SPATIAL_VALUE' must be declared
ORA-06550: line 4, column 1:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action: