Possible Duplicate:
Perl DBI Error Msg: Can't call method “selectcol_arrayref” on an undefined value
my ($ret) = $l_dbh->selectrow_array("select dummy from "
. $l_dbh->quote_identifier($dblink, 'SYSIBM', "SYSDUMMY1") );
$ret;
};
Your question is hardly clear, but it sounds like you're looking for the DBI error attributes: err
(the native database error code), errstr
(the native database error message), and state
(a standard SQLSTATE five character format, but not widely supported).
I think what you want is to follow your statement with:
my $sqlerr = $l_dbh->errstr;
However, you may not get that far if $l_dbh->{RaiseError} is set, as that will cause your program to crash on any error (with the error message). So you will want to do a
$l_dbh->{RaiseError} = 0;
first
精彩评论