I’m using MYSQL 5.5, How to do Error Handling with Nested Stored Procedure. Pretty much most of the stored procedure, does truncate table, insert into select * from and insert into on duplicate key update.
If there is any issue with any of the nested stored procedure, I would like to catch that error or tell me that error happened in that particular stored procedure.
Right now, due to the nested stored procedure, there is no way for me to know,
in which stored procedure, the exception happended.
Within each stored procedure, you can
DECLARE ... HANDLERfor the errors in which you’re interested and have them write state information to a temporary table; that table can subsequently be read by other (outer) stored procedures to determine what error(s), if any, were raised.