Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Loop to fill db with dummy data

Re: Loop to fill db with dummy data

From: Niall Litchfield <niall.litchfield_at_dial.pipex.com>
Date: Mon, 8 Apr 2002 20:53:50 +0100
Message-ID: <3cb1f54b$0$8512$cc9e4d1f@news.dial.pipex.com>


and this approach has the benefit of being faster (and easier to write) see Tom Kyte's 'mantra' from the earlier discussion on Index updates.

SQL> set timing on;
SQL> begin
  2 for i in 1..100000 loop
  3 insert into t values(i,'value '||i);   4 end loop;
  5 commit;
  6 end;
  7 /

PL/SQL procedure successfully completed.

Elapsed: 00:00:09.01
SQL> insert into t select object_id,object_name from all_objects;

31022 rows created.

Elapsed: 00:00:02.08
SQL> / 31022 rows created.

Elapsed: 00:00:01.03
SQL> / 31022 rows created.

Elapsed: 00:00:01.03
SQL> commit;

Commit complete.

Elapsed: 00:00:00.00

--
Niall Litchfield
Oracle DBA
Audit Commission UK
"Connor McDonald" <connor_mcdonald_at_yahoo.com> wrote in message
news:3CB1EBEB.4DDB_at_yahoo.com...

> cot_r wrote:
> >
> > Hi, thx for reading this.
> >
> > I have a simple table called performance( ID numeber, Name Varchar) for
> > testing purposes.
> >
> > How can i fill this table with "dummy" data. I want to insert a 1000
records
> > (id 0-1000) and name='x'.?
> >
> > How do i write a loop in SQLplus for this? ( or with somthing else)
> >
> > thx
> >
> > --
> > Outgoing mail is certified Virus Free. NAV
> > HomePage: freesco_ linux router
> > http://users.pandora.be/vanespen
>
> insert into performance
> select rownum,'x'
> from any_existing_table_with_1000_records_or_more
> where rownum < 1000
>
> hth
> connor
> --
> ==============================
> Connor McDonald
>
> http://www.oracledba.co.uk
>
> "Some days you're the pigeon, some days you're the statue..."
Received on Mon Apr 08 2002 - 14:53:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US