No data - zero rows fetched error

A stored procedure, join this statement
select lastupdate into s_lastupdate from pre_common_failedlogin where username='myname';
Prompt
0 row(s) affected, 1 warning(s): 1329 No data - zero rows fetched, selected, or processed
Not to use vernier

Started by Quintion at November 28, 2016 - 11:54 AM

What is the code, paste it

Posted by Kate at December 05, 2016 - 12:00 PM

CREATE DEFINER=`root`@`%` PROCEDURE `test`(
in P_UserName char(15),
out s_lastupdate int
)
BEGIN

select lastupdate into s_lastupdate from pre_common_failedlogin where username=P_UserName;
if s_lastupdate is null then
set s_lastupdate=0;
end if;

END

Posted by Quintion at December 06, 2016 - 12:01 PM

select lastupdate into s_lastupdate from pre_common_failedlogin where username=P_UserName;

At the command line, suggesting that what

Posted by Kate at December 20, 2016 - 12:35 PM

Very normal, there should be no matching records.

Posted by Josie at December 30, 2016 - 1:00 PM

select max(lastupdate) into s_lastupdate from pre_common_failedlogin where username='myname';
Add a function should not have warned.

Posted by Antony at January 08, 2017 - 2:08 PM

Using the select into variable, if the variable is empty, caused some unnecessary problems, lead to circular end, to avoid this problem, only need to determine whether the air in the value of the variable variable before you use, if not empty in the implementation of other operation, perfect after script:


CREATE DEFINER=`root`@`%` PROCEDURE `test`(
in P_UserName char(15),
out s_lastupdate int
)
BEGIN
select count(*) into @isnext from pre_common_failedlogin where username=P_UserName;
if(@isnext>0) then
select lastupdate into s_lastupdate from pre_common_failedlogin where username=P_UserName;
if s_lastupdate is null then
set s_lastupdate=0;
end if;

end if ;
END

Posted by Chad at January 11, 2017 - 1:42 PM