您的当前位置:首页正文

sql和plsql循环插入测试数据

来源:九壹网
==================sql循环插入测试数据=========
number strxxx number str
1 aaa 1 a
2 aaa 2 b
3 aaa 3 c
4 ccc 4 d
5 ccc 5 e

declare @number int,@string varchar(10)
select @number = number from table1 where strxxx='aaa'
select @str = str from table2 where number = @number
insert into table3(number,str)values(@number,@str)

=======================================

select count(*) from Test

declare @a int
set @a = 1
while @a<1000000
begin
insert into Test(name) values(@a)
set @a = @a + 1
end


==================plsql循环插入测试数据=========
create table Test
(
name NUMBER(19) not null
)

declare
maxrecords constant int:=1000;
i int :=1;
begin
for i in 1..maxrecords loop
insert into Test(name)
values(TO_CHAR('9999'+i));
end loop;
commit;
end;

create table UserInfo
login VARCHAR2(200 CHAR) not null
)

因篇幅问题不能全部显示,请点此查看更多更全内容

Top