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
If fetchrow() retrieves no data, the while loop terminates.
-
Ron Reidy
Lead DBA
Array BioPharma, Inc.
-Original Message-
From: Mark Martin [mailto:[EMAIL PROTECTED]
Sent: Friday, January 28, 2005 5:58 AM
To: dbi-users@perl.org
Subject: no rows selected
Hi,
I'm running
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
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