发布网友 发布时间:2022-04-08 07:43
共2个回答
懂视网 时间:2022-04-08 12:04
#!/bin/env perl 2 use DBI; 3 4 my $dbh=DBI->connect("dbi:Oracle:gzgldb","nrmdb","nrmoptr123") or die "connect db error!"; 5 6 my $sql=‘select * from router‘; 7 8 my $sth=$dbh->prepare($sql); 9 10 $sth->execute() or die "execute sql error!"; 11 12 my @row1=$sth->fetchrow_array(); 13 print "@row1 "; 14 @row1=$sth->fetchrow_array(); 15 print "@row1 num2 "; 16 17 my @row=$dbh->selectrow_array($sql); 18 print "@row "; 19 20 @row=$dbh->selectrow_array($sql); 21 22 print "@row "; 23 24 25 $sth->finish; 26 $dbh->disconnect();以下为输出结果:
由此可以看出fetchrow_array每取一次,行指针会下移一次;而selectrow_array确不会这样做。
DBI-1.634之selectrow_array与fetchrow_array的区别
标签:
热心网友 时间:2022-04-08 09:12
mysql fetch array:返回的可以用数组名称和编号