`
guoce
  • 浏览: 21915 次
  • 性别: Icon_minigender_2
  • 来自: 郑州
文章分类
社区版块
存档分类
最新评论

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
)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics