create definer = `root`@`%` function `user`.`UpdatePw` (ID varchar(64), PW varchar(127), UPW varchar(127))
returns varchar(20) charset utf8mb4
collate utf8mb4_general_ci
begin
declare returnVal varchar(20);
declare pw varchar(127);
set returnVal = "0";
select pw
into pw
from user
where id = ID ;
if pw = PW then
update user set pw = UPW where id = ID;
else
set returnVal = "1";
end if;
return returnVal;
end
참조
https://choija.tistory.com/26
https://blog.duveen.me/16
https://wakestand.tistory.com/503