On Mon, 25 Nov 2002 14:36:16 +0800 Liu Haifeng <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there anyway to execute a list of SQL statements in a batch mode
> using dbi? I just don't want to write codes like
> $dbh->do($sql1); $dbh->do($sql2); $dbh->do($sql3) ... . Can all SQL
> statesment be combined into a large string, and then be executed using
> one $dbh->do($sqls) ?
It depends on the database. Some allow it some don't. Some of the ones
that don't allow it directly may allow you to put them in a procedure or
anonymous block.
You can always use a loop, but don't forget error checking.
#!/usr/bin/perl -w
use strict;
....
$dbh -> {RaiseError} = 1;
foreach ( @SQL_List ) { $dbh -> do( $_ ); }
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.