- 论坛徽章:
- 3
|
原帖由 HF.SKY000 于 2008-11-29 12:11 发表
sub get_ci_sz{
my @ci_sz;
my @ne_id_sz;
my $sql_sz="select count(*) a,c.ci from unicom:hb_cm_cell a ,unicom:ne_bsc b ,unicom:ne_cell c where a.type1=b.china_name and c.city_id=b.city_id and ...
while(my $line=$sth->fetchrow_array) 用数组
perldoc DBI
fetchrow_array
If called in a scalar context for a statement handle that has more than one column, it is undefined whether the driver will return the value of the first column or the last. So don't do that
另外
$sth=$dbh->prepare($sql_sz);
$sth->execute(); #select 1
while(my $line=$sth->fetchrow_array){ #最好用@line
@ci_sz=$line;
my $s="select ne_id from ne_cell where n_confirm<>1 and ci=@ci_sz and city_id='114' order by 1";
$sth=$dbh->prepare($s);
$sth->execute(); #执行后,select 1的结果被覆盖了
while(my @row=$sth->fetchrow_array){
print $row[0],"\n";
}
} |
|