日期:2014-05-16  浏览次数:20774 次

急呀,请求帮忙解决个MYSQL5.1的存储过程问题,先谢谢了!
CREATE PROCEDURE login (in uname varchar(30),in upwd varchar(32), out re_uid int, out re_unetname varchar(30))
BEGIN
select re_uid:=user_id,re_unetname:=user_netname from glcity_user where user_name=uname AND user_pwd=upwd AND user_state=1 limit 1;
END;

错误信息:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':=user_id,re_unetname:=user_netname from glcity_user where user_name=uname AND u' at line 3

------解决方案--------------------
1
DELIMITER $$
CREATE PROCEDURE login (IN uname VARCHAR(30),IN upwd VARCHAR(32), OUT re_uid INT, OUT re_unetname VARCHAR(30))
BEGIN
SELECT @re_uid:=user_id,@re_unetname:=user_netname FROM glcity_user WHERE user_name=uname AND user_pwd=upwd AND user_state=1 LIMIT 1;
END;
$$

2
DELIMITER $$
CREATE PROCEDURE login (IN uname VARCHAR(30),IN upwd VARCHAR(32), OUT re_uid INT, OUT re_unetname VARCHAR(30))
BEGIN
SELECT user_id as re_uid,=user_netname as re_unetname FROM glcity_user WHERE user_name=uname AND user_pwd=upwd AND user_state=1 LIMIT 1;
END;
$$