bulk loading with DBI

G

Greg H

Hi,

I'm just wondering if anyone has experience with bulk loading data into an
Oracle database with DBI.

My options are to use DBI or Oracle's sqlloader. I'd rather do it using DBI,
but I'm not sure what kind of perfomance hit I'll incur. I need to load 2
tables on a daily basis (~50MB).

Any comments?

- Greg.
 
A

AdrianK

SQLLoader will generally be faster.

Pretty much trial an error really

For bulk inserts you should use DBI with placeholders.

Bit of pseudo code, might help...

my $sth = $dbh->prepare (SQL insert :param1, :param2 etc)
my $count = 0;

loop
$sth->bind_param(":param1", $param1);
$sth->bind_param(":param2", $param2);
...
...
eval { $sth->execute() };
if ($@) {
print "Error.......";
};
...
...
if ($count>50) { # Change this value depending on threshold,
rollback segment size etc
$self->doCommit($dbh);
$count=0;
}
$count++;

end loop

$dbh->commit



HTH
AdrianK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top