简体   繁体   中英

Mac OSX MySQL Update Stored Procedure

Good afternoon,

I am attempting to run a stored procedure that updates records in MySQL 5.1 on Mac OSX 10.4.11. Here is a sample procedure:

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `TestUpd`()
BEGIN

    UPDATE Addr
    SET eMail2 = 'test';

END
$$

When I execute this procedure, I get the error, 'Error executing SQL command'. I've tried various options, but this is the simplest example that illustrates the problem.

This does not happen when I try the same thing in MySQL 5.1 on Windows XP.

Any ideas?

Thank you,

Igal

As a follow-up, we stumbled upon a workaround and will post it here for future reference.

When we added a select statement to the stored procedure after the UPDATE statement, the procedure worked as expected. This is not an optimal workaround since you will not be able to modify your procedures in all cases, but we are able to do so in our case. The following then worked for us:

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `TestUpd`()
BEGIN

    UPDATE Addr
    SET eMail2 = 'test';

    SELECT 0;

END
$$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM