Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How can I speed up multiple inserts?
use the array interface. then you can send 10,100,1000 items all at
once.(using bind variables) Also Once you prepare you shouldn't have to
keep preparing if you keep the cursor open.
Jim
"Ole Hansen" <oha_at_unispeed.com> wrote in message
news:3D92F451.3030101_at_unispeed.com...
> Hi,
>
> I would like to insert say 1000 rows, and in my application I receive a
> char array with all the statements like - array[0]: insert into ...,
> array[1]: insert into ...
>
> All statements are for the same catalog/table.
>
> Should I call OCIStmtPrepare/OCIStmtExecute for all indices in the char
> array (as I do now), or could I speed up things by doing something
> different? What?
>
> Although all inserts are for the same table they might not all include
> values for all columns. The table could have 4 columns like:
>
> Eg.:
> array[0]: insert into some_table (a,b,c) values (1,2,3);
> array[1]: insert into some_table (a,c) values (4,5);
> array[2]: insert into some_table (a,c,d) values (7,1,4);
> array[3]: insert into some_table (a,b,c,d) values (3,3,5,2);
> etc.
>
>
> Rigth now it's like:
> i = 0;
> while (array[i]) {
> OCIStmtPrepare( ..., array[i], ...);
> OCIStmtExecute(...);
> i++;
> }
>
> How can I speed up things?
>
> Thanks in advance.
> Br,
> Ole Hansen
>
Received on Thu Sep 26 2002 - 09:35:37 CDT