Name
fetchrow_array
Synopsis
@ary = $sth->fetchrow_array;
An alternative to
fetchrow_arrayref
.
Fetches the next row of data and returns it as a list containing the
field values. Null fields are returned as undef
values in the list.
If there are no more rows, or if an error occurs, then
fetchrow_array
returns an empty list. You should
check $sth-
>err
afterwards
(or use the RaiseError
attribute) to discover if
the empty list returned was due to an error.
In a scalar context, fetchrow_array
returns the
value of the first field. An undef
is returned if
there are no more rows or if an error occurred. Since that
undef
can’t be distinguished from an
undef
returned because the first field value was
NULL, you should exercise some caution if you use
fetchrow_array
in a scalar context.
Get Programming the Perl DBI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.