写一个过程: cursor c is select a,b from a;
v_a a.a%type;
v_b a.b%type;
begin
open c;
fetch c into v_a,v_b;
while c%found loop
for i in 1..12 loop
//下面省略号部分自己写完整吧
insert into b(a,b,c1,c2,...,cn,month)values(v_a,v_b,0,0,...,0,i);
end loop;
fetch c into v_a,v_b;
end loop;
close c;
end;
v_a a.a%type;
v_b a.b%type;
begin
open c;
fetch c into v_a,v_b;
while c%found loop
for i in 1..12 loop
//下面省略号部分自己写完整吧
insert into b(a,b,c1,c2,...,cn,month)values(v_a,v_b,0,0,...,0,i);
end loop;
fetch c into v_a,v_b;
end loop;
close c;
end;
begin
for i in 1..12 loop
insert into b(a,b,c1,c2,...,cn,month) select a,b,0,0,...,0,i from a;
end loop;
commit;
end;