Home > Database > Mysql Tutorial > body text

How to Suppress \'Error 1329: No Data\' in MySQL Stored Procedures?

Patricia Arquette
Release: 2024-10-26 08:56:29
Original
269 people have browsed it

How to Suppress

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>
Copy after login

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>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!