my $sql = ''; if (cond) { $sql = $dbh->prepare(SQL_CODE); } elsif (cond2) { $sql = $dbh->prepare(SQL_CODE2); } else { $sql = $dbh->prepare(SQL_CODE3); } $sql->execute(@params);
Not only are you not storing the result of the prepare, even if you did, you must predeclare your $sql recipient variable or it'll go out of scope before you can execute it!
"Falling in love with map, one block at a time." - simeon2000
In reply to Re: $dbh->errstr;
by simeon2000
in thread $dbh->errstr;
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |