no rows selected

From: Mark Martin (mark.martin_at_nuim.ie)
Date: 01/28/05


Date: Fri, 28 Jan 2005 15:22:05 +0000
To: beginners@perl.org

Hi,
I'm running a test to see whether certain criteria in a SELECT statement
return record or not. If I get a "no rows selected" from SQL then I want to
perform a specific action . But I don't how perform the test for "no rows
selected " ?

$sql = qq{SELECT RECORD FROM TABLE WHERE FIELD = ? } ;
$sth = $dbh->prepare($sql) ;
$sth->execute($variable) ;
while (@fetch = $sth4->fetchrow)
{
if ("no rows selected " .................?????? ) ### Don't know how to
test this
{
#perform my tasks
}
Regards,Mark