Mark, you would typically do something like this: my $ct_rows_processed = 0; while (@fetch = $sth->fetchrow) { $ct_rows_processed++;
### do stuff with a row of data ### } ### end while If ($ct_rows_processed = 0) { ### perform "no rows selected" tasks here ### } HTH. Hardy Merrill >>> Mark Martin <[EMAIL PROTECTED]> 01/28/05 7:58 AM >>> 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