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 stored procedure
has a critical error, I am not getting back any indication there 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-16\')
$sth = $dbh->prepare($sql);
if (!$sth) {
...
}
my $ex_result = $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 the stored
procedure?
Thanks very much.
Daniel Kern
| Thread |
|---|
| • question about stored procedures with Select statements andcritical errors. | Daniel Kern | 19 Jul |