Perl – How to get a row count in DBI without running two separate calls to process

dbiperl

I'm running DBI in Perl and can't figure out how, when I run a prepared statement, I can figure out if the returned row count is 0.

I realize I can set a counter inside my while loop where I fetch my rows, but I was hoping there was a less ugly way to do it.

Best Answer

Based on a quick look here, it seems that after you run

$statement->execute($arg)

you can access the row count via

$statement->rows
Related Topic