码迷,mamicode.com
首页 > 数据库 > 详细

[Oracle]快速生成大量模拟数据的方法

时间:2017-09-26 13:35:46      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:nio   union   acl   方法   int   number   into   ber   create   

快速生成大量模拟数据的方法:

create table TEST(id integer, TEST_NUMBER NUMBER(18,6));

insert into TEST
 select i+j, i+j
   from  (
          with DATA2(j) as (
                            select 0 j from DUAL
                              union all
                            select j+1000 from DATA2 where j < 999000
                           )
          select j from DATA2
         ),
         (
          with DATA1(i) as (
                            select 1 i from DUAL
                              union all
                            select i+1 from DATA1 where i < 1000
                           )
          select i from DATA1
         );

这是生成10万条数据

如果生成1000完条数据,则变成:


create table TEST(id integer, TEST_NUMBER NUMBER(18,6));

insert into TEST
 select i+j, i+j
   from  (
          with DATA2(j) as (
                            select 0 j from DUAL
                              union all
                            select j+1000 from DATA2 where j < 99990000
                           )
          select j from DATA2
         ),
         (
          with DATA1(i) as (
                            select 1 i from DUAL
                              union all
                            select i+1 from DATA1 where i < 10000
                           )
          select i from DATA1
         );

[Oracle]快速生成大量模拟数据的方法

标签:nio   union   acl   方法   int   number   into   ber   create   

原文地址:http://www.cnblogs.com/gaojian/p/7596248.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!