Oracle快速创建百万数据

create table myTestTable as 
select rownum as id,
               to_char(sysdate + rownum/24/3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,
               trunc(dbms_random.value(0, 100)) as random_id,
               dbms_random.string('x', 20) random_string
          from dual
        connect by level <= 1000000;
  • 通过level控制数据量,表名随意,直接运行即可创造百万数据,耗时半分钟左右
  • 转载自:https://blog.csdn.net/yzsind/article/details/4967133

你可能感兴趣的:(数据库)