declare cursor amount is select amount from main_temp; amou number; i number:=0; begin open amount; FETCH amount into amou; while i<amou loop insert into main_pas_20061 select * from main_temp ; i:=i+1; end loop; close amount; end;数据在main_temp中,我建立一个临时表main_pas_20061 但写的不对,哪位大侠帮忙给看一下!!谢谢!!!!跪求了!!!!苦啊!
create procedure test is begin for p in (select * from main_temp) loop while p.amount>0 loop insert into main_pas_20061(amount,people,class) values(1,p.people,p.class); end loop; end loop; commit; end test;
select 1 amount, t.people ,t.class from t, (select rownum r all_objects where rownum<=55)n --?? where n.r<=t.amount;select 1 amount, t.people ,t.class from t, (select rownum r all_objects where rownum<=(select max(amount) from t) )n where n.r<=t.amount;
cursor amount is select amount from main_temp;
amou number;
i number:=0;
begin
open amount;
FETCH amount into amou;
while i<amou loop
insert into main_pas_20061 select * from main_temp ;
i:=i+1;
end loop;
close amount;
end;数据在main_temp中,我建立一个临时表main_pas_20061
但写的不对,哪位大侠帮忙给看一下!!谢谢!!!!跪求了!!!!苦啊!
begin
for p in (select * from main_temp) loop
while p.amount>0 loop
insert into main_pas_20061(amount,people,class) values(1,p.people,p.class);
end loop;
end loop;
commit;
end test;
from t, (select rownum r all_objects where rownum<=55)n --??
where n.r<=t.amount;select 1 amount, t.people ,t.class
from t, (select rownum r all_objects where rownum<=(select max(amount) from t) )n
where n.r<=t.amount;