博客园

循环插入测试数据

==================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 
) 

 

posted @ 2012-11-08 20:56  一心一意  阅读(291)  评论(0编辑  收藏  举报

Powered by:
一心一意
Copyright & JGuang