question about stored procedures with Select statements and critical errors.
"Kern, Daniel" <[email protected]> Thu, 19 Jul 2012 12:34:46 +0000
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <346DC0312886E4489F98569F83D39AFB0BEFE692@NASANEXD02A.na.qualcomm.com> |
--_000_346DC0312886E4489F98569F83D39AFB0BEFE692NASANEXD02Anaqu_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Can someone please help with the following. I am using mysql dbd 4.017 and=
mysql 5.5.17.
When I call a stored procedure that has Select statements in it, and the st=
ored procedure has a critical error, I am not getting back any indication t=
here was an error.
The SP looks like this:
Begin
SELECT CONCAT("Populating summary tables from: ",@v_from_date, " , to: ",@v=
_to_date) AS return_message;
...
<Critical Error here>
...
End
Here is the code, where $sql is call <sp name> (\'2012-06-16\', \'2012-06-1=
6\')
$sth =3D $dbh->prepare($sql);
if (!$sth) {
...
}
my $ex_result =3D $sth->execute();
And when I run in the debugger, I get this result on the statement handle:
x DBI::dump_results($sth):
'Populating summary tables from...'
1 rows
0 1
And x $sth->errstr returns:
undef
RaiseError is off. If I set it to On, I then need to run the execute in an=
eval statement. But this is not necessary if there is no Select statement=
in the SP - in that case I get this when I dump the results of $sth:
$sth->errstr();
Returns: 'PROCEDURE <db name>.<sp name> does not exist'
which is exactly the error expected.
How can I capture the error when I have at least one select statement in th=
e stored procedure?
Thanks very much.
Daniel Kern
--_000_346DC0312886E4489F98569F83D39AFB0BEFE692NASANEXD02Anaqu_--