oracle: create or replace procedure testadd is begin for a in 1..50 loop insert into test values ( a, 20); end loop; end testadd; execute testadd
create procedure testadd ( @num int) as begin declare @a int select @a=0 loop1: if @a<@num begin insert into test7 values (@a, 2 , 3 , 4) select @a=@a+1 goto loop1 endtestadd 16 插入16条 end
to smae(): 唉,楼上的兄弟写得很辛苦,可肯定不是你想要的。拜托把题说清楚, 尤其是数据的关系,摆个例表出来不是很好吗?不存在的表也是可以构建出来的,就象 解几何题的辅助线一样。
如果是sql server,insert into table(field1,field2) select field1,field2 from table2
如果是全部字段,可以像楼上说的。
vfp:
sele table1
appe from table2
情况如下:
table1每增加一条记录,就要在table2里增加16条记录,不想写16次insert table2,怎么办?
while {boolean}
begin
...
end
create or replace procedure testadd
is
begin
for a in 1..50 loop
insert into test values ( a, 20);
end loop;
end testadd;
execute testadd
as
begin
declare @a int
select @a=0
loop1:
if @a<@num
begin
insert into test7 values (@a, 2 , 3 , 4)
select @a=@a+1
goto loop1
endtestadd 16
插入16条
end
尤其是数据的关系,摆个例表出来不是很好吗?不存在的表也是可以构建出来的,就象
解几何题的辅助线一样。