存储过程
CREATE PROCEDURE getUid (IN phone CHAR(11), OUT uid INT )
READS SQL DATA
BEGIN
select u.id from mami_auth.tb_user u where u.cellphone like CONCAT('%',phone);
END;
# drop PROCEDURE getUid;
call getUid('6722',@uid);
函数
CREATE FUNCTION fn_get_uid (phone CHAR(11) )
RETURNS INT
BEGIN
RETURN (select u.id from mami_auth.tb_user u where u.cellphone like CONCAT('%',phone) );
END;
# drop FUNCTION fn_get_uid;
select fn_get_uid('6722') as uid;