create or replace procedure yqw1 is
type
array_type IS table of number INDEX BY BINARY_INTEGER;
city array_type;
-- array_zhang IS table of number INDEX BY BINARY_INTEGER;
isscount array_type;
reccount array_type;
issamount array_type;
recamount array_type;
begin
city(1):=1111;
city(2):=1111;
city(3):=1111;
for i in 1..3 loop
isscount(i):=0;
reccount(i):=0;
issamount(i):=0;
recamount(i):=0;
end loop;
for j in 1..3 loop
select LTRIM(RTRIM(count)),LTRIM(RTRIM(amount)) into isscount(j),issamount(j) from temp1 where opccode=city(j) and rpccode='1000';
select LTRIM(RTRIM(count)),LTRIM(RTRIM(amount)) into reccount(j),recamount(j) from temp1 where opccode='1000' and rpccode=city(j);
EXCEPTION
when NO_DATA_FOUND THEN
NULL;
end loop;
end yqw1;系统报什么 exception......错误
type
array_type IS table of number INDEX BY BINARY_INTEGER;
city array_type;
-- array_zhang IS table of number INDEX BY BINARY_INTEGER;
isscount array_type;
reccount array_type;
issamount array_type;
recamount array_type;
begin
city(1):=1111;
city(2):=1111;
city(3):=1111;
for i in 1..3 loop
isscount(i):=0;
reccount(i):=0;
issamount(i):=0;
recamount(i):=0;
end loop;
for j in 1..3 loop
select LTRIM(RTRIM(count)),LTRIM(RTRIM(amount)) into isscount(j),issamount(j) from temp1 where opccode=city(j) and rpccode='1000';
select LTRIM(RTRIM(count)),LTRIM(RTRIM(amount)) into reccount(j),recamount(j) from temp1 where opccode='1000' and rpccode=city(j);
EXCEPTION
when NO_DATA_FOUND THEN
NULL;
end loop;
end yqw1;系统报什么 exception......错误
你这个如果返回结果多与一条,就会报exception
改为试试
select LTRIM(RTRIM(count)),LTRIM(RTRIM(amount)) into isscount(j),issamount(j) from temp1 where opccode=city(j) and rpccode='1000' and rownum=1;
for j in 1..3 loop
begin
select LTRIM(RTRIM(count)),LTRIM(RTRIM(amount)) into isscount(j),issamount(j) from temp1 where opccode=city(j) and rpccode='1000';
select LTRIM(RTRIM(count)),LTRIM(RTRIM(amount)) into reccount(j),recamount(j) from temp1 where opccode='1000' and rpccode=city(j);
EXCEPTION
when NO_DATA_FOUND THEN
NULL;
end;
end loop;
...