DROP FUNCTION IF EXISTS account.user_getNameFromId; DELIMITER $$ CREATE DEFINER=`root`@`%` FUNCTION `account`.`user_getNameFromId`(vSelf INT) RETURNS varchar(30) CHARSET utf8 BEGIN /** * Gets user name from it's id. * * @param vSelf The user id * @return The user name */ DECLARE vName VARCHAR(30); SELECT `name` INTO vName FROM user WHERE id = vSelf; RETURN vName; END$$ DELIMITER ;