my $sth = $dbh->prepare("select * from market where commodity like ?"); $sth->execute("SPM%"); while(my $d = $sth->fetch) { ; } $sth->execute("%XXX%"); while(my $d = $sth->fetch) { ; }