首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

存储过程数组错误

2014-01-28 
存储过程数组错误:CREATE OR REPLACE procedure T_W_SELECTCALL (j NUMBER)AStYPE numtab IS TABLE OF NU

存储过程数组错误

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));

        

热点排行