Nao.. eu nao tenho uma query estatica :D<br>ex:<br>quando eu faco<br>$sql="UPDATE $table set colum3='S',colum2='S',colum4='S' where id='$id' and datahora='$data'";<br><br>$sth2 = $dbh->prepare($sql) || die $DBI::errstr;<br>$sth2->execute || die $DBI::errstr;<br><br>eu tenho que fechar o sth2 né?<br>Pois esta dentro do WHILE q recupero os dados do BANCO com o SELECT<br><br>while (@row)= $sth->fetchrow_array()) <br>{<br><br>AQUI DENTRO<br>}<br>aqui eu fecho o $sth<br><br><br><br><b><i>Igor Sutton Lopes <igor.sutton@yahoo.co.uk></i></b> escreveu:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> <br>On Aug 8, 2007, at 5:18 PM, Marco Lima wrote:<br><br>> Salve !<br>><br>> ...<br>><br>> my $sth = $dbh->prepare( qq{ SELECT campo1, campo2<br>> FROM teste<br>> WHERE datahora >= timestamp '2007-08-01<br>>
00:00:00' - internal '6 hour'<br>> ORDER BY datahora<br>> } );<br>> $sth->execute( );<br>><br>> my $array_ref = $sth->fetchall_arrayref();<br>><br>> $sth->finish( );<br>><br>> $sth= $dbh->prepare( qq{ UPDATE tabela1<br>> SET teste='33333'<br>> WHERE id= ?<br>> AND datahora= ?<br>> } );<br>><br>> foreach my $row ( @$array_ref ) {<br>> $sth->execute ( @$row );<br>> warn "Problema ao processar os resultados", $sth->errstr( ), <br>> "\n" if<br>> $sth->err( );<br>> }<br><br>Você pode também deixar de usar um statement handler caso você tenha <br>uma query estática:<br><br><code><br>my $array_ref = $dbh->selectall_arrayref(qq{ SELECT campo1, campo2 <br>FROM teste WHERE datahora >= timestamp '2007-08-01 00:00:00' -
<br>internal '6 hour' ORDER BY datahora } );<br><br>$sth= $dbh->prepare( qq{ UPDATE tabela1 SET teste='33333' WHERE id= ? <br>AND datahora= ? } );<br><br>foreach my $row ( @$array_ref ) {<br> $sth->execute ( @$row );<br> warn "Problema ao processar os resultados", $sth->errstr( ), $/<br> if $sth->err( );<br>}<br></code><br><br>Boa sorte!<br>_______________________________________________<br>Cascavel-pm mailing list<br>Cascavel-pm@pm.org<br>http://mail.pm.org/mailman/listinfo/cascavel-pm<br></blockquote><br><p> 
Alertas do Yahoo! Mail em seu celular. <a href="http://br.mobile.yahoo.com/mailalertas/">Saiba mais</a>.