为什么会发生这种情况?
mysql> DROP PROCEDURE IF EXISTS GetUserByUserID;
Query OK, 0 rows affected
mysql> DELIMITER $$
mysql> CREATE PROCEDURE GetUserByUserID(IN userID VARCHAR(32))
BEGIN
PREPARE stmt1 FROM 'SELECT u.*, usg.SCHOOL_GRADE_ID FROM PF_USER u LEFT JOIN PF_USER_SCHOOL_GRADE usg ON u.USER_ID=usg.USER_ID AND u.USER_ID=?';
SET @a = userID;
EXECUTE stmt1 USING @a;
DEALLOCATE PREPARE stmt1;
END $$
DELIMITER ;
mysql> call GetUserByUserID(000E8893F29ED6E84CECCB0FA8B869D1);
ERROR 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 'F29ED6E84CECCB0FA8B869D1)' at line 1
mysql> call GetUserByUserID(00100D6243E1E08BC17607E1AB9E3908);
ERROR 1054 : Unknown column '00100D6243E1E08BC17607E1AB9E3908' in 'field list'
答案 0 :(得分:0)
尝试调用存储过程,如: -
mysql> call GetUserByUserID('000E8893F29ED6E84CECCB0FA8B869D1');