日期:2014-05-17  浏览次数:20836 次

这个过程报错说数组错误?但是不知道错在那?请大家指导
CREATE   OR   REPLACE   procedure   "T_W_SELECTCALL "(

  j     NUMBER
  )
    AS
    tYPE       numtab       IS       TABLE       OF       NUMBER
    INDEX       BY       BINARY_INTEGER;
    results       numtab;
    callnumber   NUMBER(10);
    j   integer:=1;
    BEGIN
    FOR   MDC   IN   (SELECT   OPERATORNO   FROM   OPERATORINFO   )   LOOP
          FOR   I   IN   1..3   LOOP
                select   count(*)   into   results[j]   from   OPERATORCALLDATA   where
                  begintime> =to_date( '20070102   I:00 ', 'yyyymmdd   hh24:mi ')   and   begintime <to_date( '20070102   (I+1):00 ', 'yyyymmdd   hh24:mi ')
                  and   CALLEE= '00001 '   and   ORGCALLEE   is   not   null
                  and   calltype= '1 '   and   OPERATORNO=mdc.OPERATORNO;

          end   loop;
  insert   into   W_SELECTCALL   values(mdc.OPERATORNO, '1 ',results[1],results[2],results[3];
  commit;
  end   loop;
  END;

------解决方案--------------------
results[2],results[3];
从哪里来

只看到了results[1]


------解决方案--------------------
results 这个索引表,没看到有地方用啊
------解决方案--------------------
你这里面有几个错误:
1、索引表的下标标识应该是括号,而不是方括号,入results(1),results(2),results(3)
2、select count(*) into results[j] from OPERATORCALLDATA where......results[j]应该写成results(i)

------解决方案--------------------
insert into W_SELECTCALL values(mdc.OPERATORNO, '1 ',results(1),results(2),results(3));