我在空表中写存储过程
create or replace procedure p
is
i number:=1;
cursor c is select id from sun_t;
begin
for v_c in c
loop
exit when(i=10);
if(c%rowcount<>0)then
insert into sun_t(id) values (0);
--update sun_t set id=test_s.nextval,name='test rowcount' where current of c;
dbms_output.put_line(c%rowcount);
end if;
i:=i+1;
end loop;
commit;
end p;
为什么一行记录也没插入?????
c%rowcount<>0我改成
c%rowcount=0
c%rowcount is null
c%rowcount is not null
都不行????
cursor c is select id from sun_t;
得出的游标cursor c为空,而你后面又用这个游标来取数据,当然取不到数据,那么插入也就为空了!sun_t表里没有数据了
TRY TO CHANGE IT AS BELOW:..
IF C%FOUND THEN
..