Tuesday, 1 April 2014

Insert plus Connect By Level

Today I would like to show you a handy command to load tables with fake data.

I'm used to testing new database server whenever I have installed it and with this SQL command option I can load huge stuff of data without effort.

Let's look how, shall we ?

create table table_insert (
code number,
text varchar2(255));

insert into  table_insert select rownum,'ZZZZZZZZZZZZZAAAAAAAAAAAAA' from dual connect by level <=100000;
commit
;


This SQL command is going to insert 100.000 rows , lots of stuff and all is done in one step.


Look out ! You can specify more fields if you want but make sure there's enough space availability on the device, unless a problem of disk full crops up.

See you in my next blog.

Byeee

No comments:

Post a Comment