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;

解决方案 »

  1.   

    results[2],results[3];
    从哪里来只看到了results[1]
      

  2.   

    results   这个索引表,没看到有地方用啊
      

  3.   

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

  4.   

    insert into W_SELECTCALL values(mdc.OPERATORNO,'1',results(1),results(2),results(3));