MySQL Procedure SELECT statement not working
I current have this stored procedure. It works fine when nothing else is in the users table but the SELECT statement returns multiple rows when there is more than one user entry. Why is this happening?
DELIMITER $$
CREATE PROCEDURE CreateUser(IN EmailAddress VARCHAR(45),IN FirstName VARCHAR(45),IN LastName VARCHAR(45),IN ActivationToken VARCHAR(40))
BEGIN
DECLARE UserID INT;
INSERT INTO `users` (`EmailAddress`, `Password`, `AccountType`) VALUES (EmailAddress, 'none', '2');
SELECT `ID` INTO UserID FROM `users` WHERE `EmailAddress`=EmailAddress;
UPDATE `user_info` SET `LastName`=LastName, `FirstName`=FirstName WHERE `ID`=UserID;
UPDATE `user_activation` SET `ActivationCode`=ActivationToken;
END
Subject
Views
Written By
Posted
MySQL Procedure SELECT statement not working
2467
May 05, 2014 08:15PM
1033
May 05, 2014 10:07PM
1026
May 07, 2014 08:13PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.