Why do you think that's painful? The only difference is the eval wrapper and the following if. In any case you'd have to execute all forty statements -- either in your script or in your proc.
Now, the fact that you're using variables with number suffixes is a quick hint that you should be using an array instead. In other words, make an array of statement handles, prepare them, then:
Although I'm still not sure I understood what the pain you're referring to is.eval { $_->execute foreach @sth; }; if ($@) { $dbh->rollback; } else { $dbh->commit; }
In reply to Re: Recoding a multi-sql-statement storedProc transaction in a script
by VSarkiss
in thread Recoding a multi-sql-statement storedProc transaction in a script
by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |