/**用户登录存储过程**/
drop PROCEDURE if exists custLogin ;
CREATE PROCEDURE custLogin ()
BEGIN
DECLARE userID VARCHAR(20);
DECLARE userPwd VARCHAR(20);
DECLARE userState int;
select userID,userRealName,(case userSex when 0 then '男' else '女'
 end) as userSex,userTel,userEmail,userBirthday, userAddr,
(case userSex when 0 then '管理员' else '内部用户' end) as userType
 from T_users where userID=userID and userPwd=userPwd 
and userState=userState;
END;
请大家帮看看  什么错误

解决方案 »

  1.   

    报错呢?
    应该是你没delimiter吧 
      

  2.   

    DELIMITER $$DROP PROCEDURE IF EXISTS `test`.`custLogin`$$CREATE PROCEDURE `test`.`custLogin`()    BEGIN
    DECLARE userID VARCHAR(20);
    DECLARE userPwd VARCHAR(20);
    DECLARE userState int;
    select userID,userRealName,(case userSex when 0 then 'ÄÐ' else 'Å®'
    end) as userSex,userTel,userEmail,userBirthday, userAddr,
    (case userSex when 0 then '¹ÜÀíÔ±' else 'ÄÚ²¿Óû§' end) as userType
    from T_users where userID=userID and userPwd=userPwd
    and userState=userState;
        END$$DELIMITER ;
      

  3.   

    select userID,userRealName,(case userSex when 0 then '男' else '女'
     end) as userSex,userTel,userEmail,userBirthday, userAddr,
    (case userSex when 0 then '管理员' else '内部用户' end) as userType
     from T_users where userID=userID and userPwd=userPwd 
    and userState=userState;    不知道userSex 到底是什么字段怎么一会用来判断性别,一会用来判断用户类型。