# 字串反轉
DROP FUNCTION `while_ex`;
CREATE DEFINER=`root`@`localhost` FUNCTION `while_ex`(`str` VARCHAR(255)) RETURNS VARCHAR(255) NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER begin
declare _ varchar(255) default '';
while not str is null and str<>'' do
set _ = concat(_, substr(str, -1,1));
set str = substr(str,1, length(str)-1);
end while;
return _;
end
沒有留言:
張貼留言