DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getUserId`(userName varchar(30))
RETURNS int(11)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE vUser INT;
SELECT id INTO vUser
FROM account.user
WHERE `name` = userName;
RETURN vUser;
END$$
DELIMITER ;