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

Home -> Community -> Usenet -> c.d.o.server -> Re: Doing multiple row inserts using one insert statement

Re: Doing multiple row inserts using one insert statement

From: Serge Rielau <srielau_at_ca.ibm.com>
Date: Mon, 18 Apr 2005 17:15:37 -0400
Message-ID: <3cimbtF6kf4ekU1@individual.net>


Andreas Sheriff wrote:
> 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.
>
> Hope this helps to optimize your code.
>

create type myarray as table of number;

insert into t select * from table(myarray(1,2,3,4));

Cheers
Serge

-- 
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Received on Mon Apr 18 2005 - 16:15:37 CDT

Original text of this message

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