1、在sql窗口创建一个数组类型 create or replace type arrtype is table of integer;2、创建一个存储过程 CREATE OR REPLACE PROCEDURE test_array_param(a IN arrtype, total OUT INTEGER) IS --求数据元素的和 temp PLS_INTEGER := 0; BEGIN FOR i IN 1 .. a.count LOOP dbms_output.put_line(a(i)); temp := temp + a(i); END LOOP; total := temp; END test_array_param; /3、在调试界面的test script窗口的脚本如下(注意注释那句) declare -- Non-scalar parameters require additional processing a arrtype; begin -- Call the procedure a := arrtype(2,4); --这一行数组初始化需要手动增加 test_array_param(a => a, total => :total); end; 没有图床不好贴图,请凉
create or replace type arrtype is table of integer;2、创建一个存储过程
CREATE OR REPLACE PROCEDURE test_array_param(a IN arrtype, total OUT INTEGER) IS
--求数据元素的和
temp PLS_INTEGER := 0;
BEGIN
FOR i IN 1 .. a.count LOOP
dbms_output.put_line(a(i));
temp := temp + a(i);
END LOOP;
total := temp;
END test_array_param;
/3、在调试界面的test script窗口的脚本如下(注意注释那句)
declare
-- Non-scalar parameters require additional processing
a arrtype;
begin
-- Call the procedure
a := arrtype(2,4); --这一行数组初始化需要手动增加
test_array_param(a => a,
total => :total);
end;
没有图床不好贴图,请凉