SQLSTATE and SQLCODE variables in Perl
The Perl DBI module provides methods for returning the SQLSTATE and SQLCODE associated with a Perl DBI database or statement handle.
To return the SQLSTATE associated with a Perl DBI database handle
or statement handle, call the state method. For
example, to return the SQLSTATE associated with the database handle
$dbhandle, include the my $sqlstate = $dbhandle->state;
Perl
statement in your application:
To return the SQLCODE associated with a Perl DBI database handle
or statement handle, call the err method. To return
the message for an SQLCODE associated with a Perl DBI database handle
or statement handle, call the errstr method. For
example, to return the SQLCODE associated with the database handle
$dbhandle, include the my $sqlcode = $dbhandle->err;
Perl
statement in your application: