简体   繁体   English

更新TIME mysql存储过程

[英]Update TIME mysql stored procedure

mySql : Your SQL query has been executed successfully mySql :您的SQL查询已成功执行

0 rows affected by the last statement inside the procedure 0行受该过程中的最后一条语句影响

CREATE DEFINER=`root`@`localhost` PROCEDURE `update_adm`(OUT `sp_out` INT(11), IN `sp_email` VARCHAR(50) CHARSET utf8)
NO SQL
BEGIN 
UPDATE `admin` SET `last_try`=curtime() WHERE `email`=sp_email;
SET sp_out=ROW_COUNT();
END

why 0 rows affected by the last statement inside the procedure ?! 为什么0行受过程中的最后一条语句影响?

edited : 编辑:

When I replace sp_email with correct value like navid@yahoo.com in my stored procedure, it works perfectly ! 当我在存储过程中用正确的值(例如navid@yahoo.com)替换sp_email时,它可以正常工作!

CREATE DEFINER=`root`@`localhost` PROCEDURE `update_adm`()
NO SQL
BEGIN 
UPDATE `admin` SET `last_try`=curtime() WHERE `email`='navid@yahoo.com';
END

From the MySQL command line, the output is as expected. 从MySQL命令行,输出是预期的。

mysql> delimiter $$
mysql> CREATE DEFINER=`root`@`localhost PROCEDURE update_adm( ...
    -> END$$
Query OK, 0 rows affected (0.16 sec)

mysql> delimiter ;

mysql> insert into admin values (null,'foo');
Query OK, 1 row affected (0.00 sec)

mysql> call update_adm(@cnt,'foo');
Query OK, 1 row affected (0.00 sec)

mysql> call update_adm(@cnt,'bar');
Query OK, 0 rows affected (0.00 sec)

When I call the procedure with an email that exists, I get a message back showing 1 row was affected. 当我使用存在的电子邮件调用该过程时,我收到一条消息,显示有1行受到影响。 When I call the procedure with an email that does exist, it returns a message back showing 0 rows affected. 当我使用确实存在的电子邮件调用该过程时,它将返回一条消息,显示受影响的0行。

I believe the message you are seeing is from the client interface. 我相信您看到的消息来自客户端界面。 What client are you using to call the procedure? 您正在使用哪个客户端调用该过程?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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