$sth->prepare("SELECT * FROM db WHERE field < 2000"); while (@row = $sth->fetch) { ... } #### while ($row = $sth->fetchrow_hashref) { ...