Getting SQLEXCEPTION message in procedures MySQL 5.5.x

拜拜、爱过 提交于 2019-11-30 16:23:16
Pred

As I know, there is no way to emulate or replace the functionality of GET DIAGNOSTICS in lower versions of MySQL (lower than 5.6.4).

There are many entries on bugs.mysql.com and on MySQL forums which asks this feature. (Lke this one: http://bugs.mysql.com/bug.php?id=11660)

I do not know that you can or can not upgrade your MySQL instance, but as I know, this is your only chance.

I found (possibly you found them too) some questions related to this one, but all of them are either talking about version 5.6.4 or there are no answers:

EDIT

If you can, handle the MySQL errors in the client application.

You can list the errors and warnings with SHOW ERRORS and SHOW WARNINGS statements outside of the HANDLERs, but you can not insert the result of those statements into a table. Inside the handler, those statements will give empty resultset.

For specific states, you can declare individual handlers. This way, you could know the state, but you do not know any other details.

Check out this article: http://www.mysqltutorial.org/mysql-error-handling-in-stored-procedures/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!