[MySQL]function 비밀번호 변경 함수

해내면 그만!XX·2022년 9월 14일
0
post-custom-banner
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

post-custom-banner

0개의 댓글