在plsql developer中调试procedure和function时,如果有输入参数为数组,那么在调试时,数组的输入方式是怎样的?最好有图!

解决方案 »

  1.   

    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;
    没有图床不好贴图,请凉