sh-3.2$ cat a7.pl
#!/usr/bin/perl
use strict;
use DBI;
my $dbName = 'orcl';
my $dbUser = 'test';
my $dbUserPass = 'test';
my $dbh = DBI->connect("dbi:Oracle:$dbName", $dbUser, $dbUserPass) or die "can't connect to database ";
my $sth = $dbh ->prepare('select * from a7 where id = ?');
my @ids = qw/1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25/;
foreach my $id (@ids) {
$sth->execute($id);
print "\$sth is $sth\n";
while (my @arr = $sth->fetchrow_array()){
print "@arr\n";
}
}
$sth->finish;
Perl DBI使用绑定变量
最新推荐文章于 2020-07-05 12:22:49 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)