sub upload { my ($csv_file, $table, $col1, $col2, $col3) = ($_[0], $_[1], $_[2], $_[3], $_[4]); my $csv = Text::CSV->new ( { binary => 1 } ) or die "Cannot use CSV: ".Text::CSV->error_diag (); open my $fh, "<:encoding(utf8)", $csv_file or die " $!"; <$fh>; ### this is to remove the column headers. my $dbh = DBI->connect ("dbi:Oracle:host=t;sid=SID;port=1526", 'username', 'password', { RaiseError => 1, AutoCommit => 1, TraceLevel => 0 }) or die "Cannot create Database Handle: $DBI::errstr()"; my $sth = $dbh->prepare ("INSERT INTO $table ($col1, $col2, $col3) VALUES (?,?,?)"); while ( my $row = $csv->getline ($fh)) { $sth->execute ($row->[0], $row->[1], $row->[2]); } $sth->finish(); $dbh->disconnect(); close $fh; }