Using placeholders you should be able to do something like this:
I'm not entirely sure if you can use placeholders in the WHERE like I've shown here. Also I haven't used any error trapping here, and you definitely should - read about RaiseError and PrintError.my $up = qq{ UPDATE Prior_to_CI_calc_A_.$region SET SUM_wi = ?, Sum_wixi_x_1000 = ?, Sum_wi2xi_x_1000 = ? WHERE A.Aggregated_area LIKE ? AND A.Cause LIKE ? }; ### Do print here to see what $up contains ### print STDERR "\$up=$up\n"; my $sth = $dbh->prepare($up); $sth->execute($SUM_Weight_wi, $SUM_wixi_x_1000, $SUM_wi2xi_x_1000_fill, $Aggregated_area_fill, $Cause_fill);
You can also use '$dbh->trace(2);' to see what sql is being sent to the database. You should definitely read the excellent DBI perldocs if you haven't already - by doing
at a command prompt.perldoc DBI
HTH.
In reply to Re: SQL Update Error
by hmerrill
in thread SQL Update Error
by Win
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |