Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Doing multiple row inserts using one insert statement
Hey! You saw the "Ministry of Silly Walks," didn't you?
-- Andreas Oracle Certified DBA and PL/SQL Developer "If you don't eat your meat, you cannot have any pudding. "How can you have any pudding if you don't eat your meat?!?!" --- WARNING: DO NOT REPLY TO THIS EMAIL Reply to me only on this newsgroup "Rene Nyffenegger" <rene.nyffenegger_at_gmx.ch> wrote in message news:d41g1n$r0t$1_at_klatschtante.init7.net... > On 2005-04-18, Andreas Sheriff <spamcontrol_at_iion.com> wrote:Received on Mon Apr 18 2005 - 18:34:42 CDT
>> Hi,
>>
>> I was just pondering this, to see if it would work and it did.
>>
>> Here is a snippet of how to do multiple inserts using one insert
>> statement:
>>
>> /* Example of multi-value insert: */
>>
>> create table test
>> (
>> testid number,
>> testval varchar2(4000));
>>
>>
>> insert into test (testid, testval)
>> select 1, 'value of 1' from dual union all
>> select 2, 'value of 2' from dual union all
>> select 3, 'value of 3' from dual;
>>
>>
>> Hypothesizing, it could even be faster if you pin the dual table, but I
>> haven't done any metrics on that, though.
> > If you have 10g and like it a bit more esoteric: > > > create table test ( > testid number, > testval varchar2(20) > ); > > insert into test > select i, 'Value of ' || i from (select 1 i from dual) > model > dimension by (0 d) > measures (i) > rules iterate(2) ( > i[iteration_number+1] = i[iteration_number]+1 > ); > > select * from test; > > drop table test; > > > -- > Rene Nyffenegger > http://www.adp-gmbh.ch/