开发者

How to get the exact Oracle Error message on a select without the text and store in variable [duplicate]

开发者 https://www.devze.com 2022-12-22 05:46 出处:网络
This question already has answers here: 开发者_Python百科 Closed 10 years ago. Possible Duplicate:
This question already has answers here: 开发者_Python百科 Closed 10 years ago.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消