【Oracle】ORACLE測試用創建表的語句彙總

1、Oracle創建百萬大表---數據隨機---用循環


create table testt1 (id number, name varchar2(1));
begin
for i in 1 … 1000000 loop
insert into testt1 values(i, dbms_random.string(‘a’,1));
end loop;
commit;
end;
/

2、Oracle創建百萬大表---有時間戳---用存儲過程


create table testt2(
ID NUMBER(10) NOT NULL PRIMARY KEY,
NAME VARCHAR(50),
time1 timestamp
);

create or replace procedure insert_testt2 is
i number;
begin
i:=0;
loop
i:=i+1;
if i>1000000 then
exit;
end if;
insert into testt2(id,name,time1) values(i,i,sysdate);
commit;
end loop;
end insert_testt2;
/

call insert_testt2();

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章