为什么我的查询什么结果也没有返回?
ATCG 2002-07-15 01:31:03 1、为什么我的查询什么结果也没有返回?数据库表里面有记录的。
我把fetchrow_hashref改成fetchrow_arrayref就有了。
2、为什么加了use strict就报以下的错?
Global symbol "$record_hash" requires explicit package name at
F:\Perl\test.pl line 10.
#!/perl/bin/perl
use DBI;
my $dbh = DBI->connect("dbi:Oracle:study", 'test','test');
#my $sql = qq{select * From student};
my $sth = $dbh->prepare( "select * From student ");
my %record_hash;
$sth->execute();
while ($record_hash = $sth->fetchrow_hashref)
{
print "$record_hash->{name} $record_hash->{class}"."\n";
}
$sth->finish;
$dbh->disconnect;
exit;