Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidhooey/6451017 to your computer and use it in GitHub Desktop.
Save davidhooey/6451017 to your computer and use it in GitHub Desktop.
Oracle Create Million Row Table With Unique ID
drop table million;
drop sequence million_sequence;
create table million
(
id number,
type varchar2(50),
constraint million_id_pk primary key (id)
);
create sequence million_sequence start with 1 nocycle;
declare
rows_inserted number := 0;
begin
loop
insert into million(id, type)
values(million_sequence.nextval, dbms_random.string('U', 1));
rows_inserted := rows_inserted + 1;
exit when rows_inserted = 1000000;
end loop;
commit;
end;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment