读书人

存储过程数组错误

发布时间: 2014-01-28 21:28:42 作者: rapoo

存储过程数组错误

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

        

读书人网 >oracle

热点推荐