Removing the "Error 1329: No Data - Zero Rows Fetched, Selected, or Processed" Message
In stored procedures that do not return any values, you may encounter the error message "Error 1329: No data - zero rows fetched, selected, or processed" after execution. This error message can be suppressed by adding the following line:
<code class="sql">DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;</code>
Background:
MySQL displays this warning due to an internal bug, even if the error was handled. To resolve this issue, you can insert a dummy statement that involves a table and is successful, which will clear the warning.
Example:
In the provided stored procedure, testing_proc, you can add the following statement after the end of the loop:
<code class="sql">SELECT name INTO l_name FROM customer_tbl LIMIT 1;</code>
This statement will execute successfully and suppress the error message.
On MySQL 5.5.13 and later, the warning may no longer appear after adding the dummy statement. However, it's still recommended to include it to ensure compatibility with older versions.
The above is the detailed content of How to Suppress \'Error 1329: No Data\' in MySQL Stored Procedures?. For more information, please follow other related articles on the PHP Chinese website!