Name
$DBI::err
Synopsis
$error_code = $handle->err;
$DBI::err
returns the error code for the last DBI
error encountered. This error number corresponds to the error message
returned from $DBI::errstr
. The variable
$DBI::err
performs the same function. This
function is available from both database and statement handles.
Example
use DBI; my $db = DBI->connect('DBI:mysql:mydata','webuser','super_secret_squirrel'); # There is a parse error in this query... my $output = $db->prepare('SLECT * from mydata'); $output->execute; if (not $output) { print "Error $DBI:err: $DBI:errstr\n"; }
Get MySQL and mSQL 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.