我正在尝试通过 MySQL 监视器加载以下存储过程并收到此错误。相关表的架构如下。提前致谢:
ERROR 1064 (42000):您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的“p_lname VARCHAR、p_addr VARCHAR、p_cty VARCHAR、p_pcode INT、p_ctry VARCHAR、p_”附近使用正确的语法
delimiter //
CREATE PROCEDURE saveProfile(
p_fname VARCHAR,
p_lname VARCHAR,
p_addr VARCHAR,
p_cty VARCHAR,
p_pcode INT,
p_ctry VARCHAR,
p_ph INT,
p_mail VARCHAR)
BEGIN
DECLARE v_usr INT;
UPDATE Users SET first_name = p_fname,
last_name = p_lname
WHERE email = p_mail;
SET v_usr = (SELECT user_id from Users WHERE email = p_mail);
UPDATE Contact_info SET address = p_addr,
city = p_cty,
post_code = p_pcode,
country = p_ctry,
phone = p_ph
WHERE user_id = v_usr;
END//
delimiter ;
mysql> describe Users;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| user_id | int(11) | NO | PRI | NULL | auto_increment |
| email | varchar(255) | NO | UNI | NULL | |
| password | varchar(255) | YES | | NULL | |
| token | varchar(255) | NO | | NULL | |
| verified | tinyint(1) | NO | | 0 | |
| first_name | varchar(255) | YES | | NULL | |
| last_name | varchar(255) | YES | | NULL | |
+------------+--------------+------+-----+---------+----------------+
mysql> describe Contact_info;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| address_id | int(11) | NO | PRI | NULL | auto_increment |
| address | varchar(255) | YES | | NULL | |
| city | varchar(255) | YES | | NULL | |
| country | varchar(255) | YES | | NULL | |
| post_code | int(11) | YES | | NULL | |
| phone | varchar(30) | YES | | NULL | |
| user_id | int(11) | YES | MUL | NULL | |
| street | varchar(255) | YES | | NULL | |
+------------+--------------+------+-----+---------+----------------+