my $dbh = DBI->connect( qw(DBI:Oracle: user pass), {RaiseError => 1}, ); # with RaiseError turned on, no need for die and errstr $dbh->do("truncate table directory_data"); my $sth = $dbh->prepare(q{ INSERT INTO directory_data( dn, cn, surname, given_name, initials, generational_qualifier, building, room_number, mailstop, telephone, fax, mail, tfs_id, uid ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?) }); $sth->execute($employee{$_},.,....) for keys %employee; #### my @field = qw( dn cn surname given_name initials generational_qualifier building room_number mailstop telephone fax mail tfs_id uid ); my $table = 'directory_data'; my $sql = "insert into $table (" . join(',', @field) . ') values (' . join(',', map '?', @field) . ')' ;