個(gè)人實(shí)驗(yàn)的時(shí)候有時(shí)會(huì)用到一些大表,在此分享用dba_objects來(lái)創(chuàng)建測(cè)試大表的方法: 首先建立測(cè)試表 SYS@ORCLcreate table test nologging as select rownum id,a.* from dba_objects a where 1=2; Table created. 插入500萬(wàn)條數(shù)據(jù): SYS@ORCLdeclare l_cnt n
個(gè)人實(shí)驗(yàn)的時(shí)候有時(shí)會(huì)用到一些大表,,在此分享用dba_objects來(lái)創(chuàng)建測(cè)試大表的方法:
首先建立測(cè)試表
SYS@ORCL>create table test nologging as select rownum id,a.* from dba_objects a where 1=2;
Table created.
插入500萬(wàn)條數(shù)據(jù):
SYS@ORCL>declare
l_cnt number;
l_rows number:=&1;
begin
insert /*+ append */ into test select rownum,a.* from dba_objects a;
l_cnt:=sql%rowcount;
commit;
while(l_cnt
loop
insert /*+ append */ into test select rownum+l_cnt,
owner,object_name,subobject_name,
object_id,data_object_id,
object_type,created,last_ddl_time,
timestamp,status,temporary,
generated,secondary
from sales
where rownum<=l_rows-l_cnt;
l_cnt:=l_cnt+sql%rowcount;
commit;
end loop;
end; 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
22 /
Enter value for 1: 5000000
old 3: l_rows number:=&1;
new 3: l_rows number:=5000000;
PL/SQL procedure successfully completed.
Copyright ? 2019- 91gzw.com 版權(quán)所有 湘ICP備2023023988號(hào)-2
違法及侵權(quán)請(qǐng)聯(lián)系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市萬(wàn)商天勤律師事務(wù)所王興未律師提供法律服務(wù)