我有一个包含函数的包,如下所示,它需要一个参数,即array。
create or replace PACKAGE selected_pkg IS
TYPE NUM_ARRAY IS TABLE OF NUMBER;
FUNCTION get_selected_kml(
in_layer IN NUMBER,
in_solm_id IN NUMBER,
in_feature_ids IN NUM_ARRAY,
in_lx IN NUMBER,
in_ly IN NUMBER,
in_ux IN NUMBER,
in_uy IN NUMBER)
RETURN CLOB;
END selected_pkg;
现在我试图通过跟随匿名块调用该函数:
declare
result CLOB;
TYPE NUM_ARRAY1 IS TABLE OF NUMBER;
myarray NUM_ARRAY1 := NUM_ARRAY1 ();
begin
myarray.extend(3);
myarray(1) := 1;
myarray(2) := 5;
myarray(3) := 9;
EXECUTE IMMEDIATE 'truncate table demoresult';
result:=SELECTED_PKG.get_selected_kml(103, 19, myarray, 4.11, 56.27, 4.59, 56.39);
insert into demoresult values(result);
COMMIT;
end;
我收到错误
PLS-00306:调用'GET_SELECTED_KML'时参数的数量或类型错误
有人可以建议我,我做错了什么?
谢谢, Alankar
答案 0 :(得分:4)
您需要使用与您的函数相同的数组类型
declare
result CLOB;
myarray selected_pkg.num_array := selected_pkg.num_array();
begin
myarray.extend(3);
myarray(1) := 1;
myarray(2) := 5;
myarray(3) := 9;
EXECUTE IMMEDIATE 'truncate table demoresult';
result:=SELECTED_PKG.get_selected_kml(103, 19, myarray, 4.11, 56.27, 4.59, 56.39);
insert into demoresult values(result);
COMMIT;
end;