NIPP, SCOTT V (SBCSI) wrote:
I have a table with 22 columns, and my INSERT on this table is
actually putting in data to possibly all 22 fields. My question is, is
there a better way to write this INSERT? Here's what I have:
while ($line = <DATA>) {
$csv->parse($line);
@data = $csv->fields;
$sth = $dbh->prepare(qq{INSERT INTO AllMid_Data
VALUES(?,?,?,?,?,?,?,?,?,?,?,?
,?,?,?,?,?,?,?,?,?,?)}) or print "Error with INSERT _prepare_:
$DBI::errstr\n";
Put the prepare outside the loop - it only needs to be done once
use the 'x' contruct to build the slq