DECLARE CONTINUE HANDLER FOR NOT FOUND
SET row_not_found = TRUE;
In the last example we used an Error Handler, so we should talk about the options available for Error Handling in MySQL
There are around 1000 SQL State codes defined by the ANSI Standard, which apply to all SQL languages
Each vendor (like MySQL) create more specific Error Codes, so some State Codes may contain many of the thousands of error codes created for MySQL
You can create you own Error Handler (based on the error codes) or use one of the 3 Built in Error Handlers, which are:
Here is the Error Handler from the last Example
NOT FOUND
SQLEXCEPTION
SQLWARNING
Notice we used the “ NOT FOUND” built in handler in the last example