-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE FUNCTION `bank`.`FetchUserDetails` (parUname varchar(45), parpassword varchar(45),parusertype varchar(45))
RETURNS varchar(200)
DETERMINISTIC
BEGIN
declare varuname varchar(45);
declare varpassword varchar(45);
declare varuseType varchar(45);
select username,password,userType into varuname,varpassword,varuseType
from bank.user
where varuname = parUname and
varpassword = parpassword and
varuseType = parusertype;
RETURN varuname and varpassword and varuseType;
END
Can someone please tell me what is wrong with this sql statement?
what i am trying to do is authenticate a user based on the details provided and after authenticating return the username, password and role to the calling method.